Skip to content

Commit 8e86492

Browse files
committed
Drop -march=native flag.
1 parent d2133e6 commit 8e86492

File tree

5 files changed

+78
-33
lines changed

5 files changed

+78
-33
lines changed

.github/workflows/build_and_test.yml

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ permissions:
2424
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2525
jobs:
2626
build_and_test_python:
27-
continue-on-error: true
2827
strategy:
28+
fail-fast: false
2929
matrix:
3030
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
3131
compiler: ['gcc', 'clang']
@@ -78,59 +78,80 @@ jobs:
7878
python_wheels:
7979
needs: build_and_test_python
8080
runs-on: ubuntu-latest
81-
container:
82-
image: quay.io/pypa/manylinux_2_28:latest
81+
permissions:
82+
packages: write
8383
env:
8484
PY_VER: ${{ matrix.python-version }}
8585
BASE_IMAGE: quay.io/pypa/manylinux_2_28:latest
86+
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
8687
environment:
8788
name: pypi
8889
url: https://pypi.org/p/asyncproxy
89-
permissions:
90-
id-token: write
91-
continue-on-error: true
9290
strategy:
91+
fail-fast: false
9392
matrix:
9493
python-version: ['3.9', '3.11', '3.12']
9594
steps:
96-
- name: Install git
97-
run: |
98-
yum install -y git redhat-lsb-core gnupg2 wget ca-certificates yum-utils jq
99-
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
100-
yum install -y docker-ce-cli
95+
- name: Set up Python ${{ env.PY_VER }}
96+
uses: actions/setup-python@v5
97+
with:
98+
python-version: ${{ env.PY_VER }}
10199

102100
- uses: actions/checkout@v4
103101

104-
- name: Set up Python
105-
run: sh -x scipts/build/install_depends_yum.sh
106-
107-
- name: Install dependencies
108-
run: sh -x scipts/build/install_depends_wheels.sh
109-
110102
- name: Set up QEMU
111103
uses: docker/setup-qemu-action@v3
112104

105+
- name: Set up Docker Buildx
106+
uses: docker/setup-buildx-action@v3
107+
108+
- name: Login to GitHub Container Registry
109+
uses: docker/login-action@v3
110+
with:
111+
registry: ghcr.io
112+
username: ${{ github.repository_owner }}
113+
password: ${{ secrets.GITHUB_TOKEN }}
114+
113115
- name: Set dynamic environment
114116
id: set-env
115117
run: |
116118
PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \
117119
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
118120
sort -u | grep -v unknown | paste -sd ','`"
119-
BUILD_MATRIX="`echo ${PLATFORMS} | tr ',' '\n' | jq -R . | jq -s . | tr '\n' ' '`"
120121
GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
121122
GIT_BRANCH="${GIT_BRANCH#refs/tags/}"
122-
BUILD_IMAGE="${{ inputs.ghcr-repo }}:rtp.io-${{ inputs.rtpp-tag }}-${GIT_BRANCH}"
123+
BUILD_IMAGE="${GHCR_REPO}:${GIT_BRANCH}-py${PY_VER}"
123124
echo "Platforms: ${PLATFORMS}"
124-
echo "platforms=${PLATFORMS}" >> $GITHUB_OUTPUT
125-
echo "build-matrix=${BUILD_MATRIX}" >> $GITHUB_OUTPUT
126-
echo "build-image=${BUILD_IMAGE}" >> $GITHUB_OUTPUT
127-
echo "git-branch=${GIT_BRANCH}" >> $GITHUB_OUTPUT
128-
129-
- name: build
125+
echo "Build Image: ${BUILD_IMAGE}"
126+
echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
127+
echo "BUILD_IMAGE=${BUILD_IMAGE}" >> $GITHUB_ENV
128+
129+
- name: Build Docker image
130+
uses: docker/build-push-action@v6
131+
env:
132+
CACHE_SPEC: "type=registry,ref=${{ env.BUILD_IMAGE }}-buildcache"
133+
with:
134+
context: .
135+
file: ./docker/Dockerfile.python_wheels
136+
build-args: |
137+
BASE_IMAGE=${{ env.BASE_IMAGE }}
138+
PY_VER=${{ env.PY_VER }}
139+
platforms: ${{ env.PLATFORMS }}
140+
push: false
141+
outputs: type=local,dest=.
142+
cache-from: ${{ env.CACHE_SPEC }}
143+
cache-to: ${{ env.CACHE_SPEC }},mode=max
144+
145+
- name: Show context tree
146+
run: ls -R .
147+
148+
- name: Collect Wheels
130149
run: |
131-
python${PY_VER} setup.py build sdist
132-
python${PY_VER} -m build --wheel
133-
auditwheel repair dist/*.whl --wheel-dir dist/
150+
mv `find dist -type f` dist
151+
rmdir `find python/ -type d -depth 1 -depth`
152+
153+
- name: Show context tree
154+
run: ls -R dist
134155

135156
- name: Publish package distributions to PyPI
136157
if: github.event_name == 'release' && github.event.action == 'created'

docker/Dockerfile.python_wheels

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# syntax=docker/dockerfile:1.7-labs
2+
3+
ARG BASE_IMAGE="quay.io/pypa/manylinux_2_28:latest"
4+
FROM --platform=$TARGETPLATFORM $BASE_IMAGE AS build
5+
LABEL maintainer="Maksym Sobolyev <[email protected]>"
6+
7+
USER root
8+
9+
WORKDIR /src
10+
11+
ARG TARGETPLATFORM
12+
ARG PY_VER
13+
RUN --mount=type=bind,source=scripts/build,target=scripts/build \
14+
sh -x scripts/build/install_depends_yum.sh
15+
RUN --mount=type=bind,source=scripts/build,target=scripts/build \
16+
sh -x scripts/build/install_depends_wheels.sh
17+
18+
COPY --exclude=.git --exclude=.github --exclude=docker --exclude=dist \
19+
--exclude=scripts . .
20+
21+
RUN python${PY_VER} setup.py build sdist
22+
RUN python${PY_VER} -m build --wheel
23+
RUN auditwheel repair dist/*.whl --wheel-dir dist_out
24+
RUN ls -R dist_out
25+
26+
FROM scratch AS export
27+
COPY --from=build /src/dist_out /dist
File renamed without changes.

scipts/build/install_depends_yum.sh renamed to scripts/build/install_depends_yum.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ then
88
dnf module enable python${PY_VER} -y
99
fi
1010

11-
dnf install -y python${PY_VER} python${PY_VER}-devel
11+
dnf install -y redhat-lsb-core python${PY_VER} python${PY_VER}-devel

setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424

2525
debug_opts = ('-g3', '-O0')
2626
nodebug_opts = ('-DNO_DEBUG',)
27-
if not is_mac and not is_win:
28-
nodebug_opts += ('-march=native', '-O3')
29-
else:
30-
nodebug_opts += ('-O3',) if not is_win else ()
27+
nodebug_opts += ('-O3',) if not is_win else ()
3128
if False:
3229
extra_compile_args.extend(debug_opts)
3330
extra_link_args.extend(debug_opts)

0 commit comments

Comments
 (0)