@@ -24,8 +24,8 @@ permissions:
2424# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2525jobs :
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,68 @@ 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
8990 permissions :
9091 id-token : write
91- continue-on-error : true
9292 strategy :
93+ fail-fast : false
9394 matrix :
9495 python-version : ['3.9', '3.11', '3.12']
9596 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
97+ - name : Set up Python ${{ env.PY_VER }}
98+ uses : actions/setup-python@v5
99+ with :
100+ python-version : ${{ env.PY_VER }}
101101
102102 - uses : actions/checkout@v4
103103
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-
110104 - name : Set up QEMU
111105 uses : docker/setup-qemu-action@v3
112106
107+ - name : Set up Docker Buildx
108+ uses : docker/setup-buildx-action@v3
109+
113110 - name : Set dynamic environment
114111 id : set-env
115112 run : |
116113 PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \
117114 jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
118115 sort -u | grep -v unknown | paste -sd ','`"
119- BUILD_MATRIX="`echo ${PLATFORMS} | tr ',' '\n' | jq -R . | jq -s . | tr '\n' ' '`"
120116 GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
121117 GIT_BRANCH="${GIT_BRANCH#refs/tags/}"
122- BUILD_IMAGE="${{ inputs.ghcr-repo }}:rtp.io-${{ inputs.rtpp-tag }}- ${GIT_BRANCH}"
118+ BUILD_IMAGE="${GHCR_REPO}: ${GIT_BRANCH}"
123119 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
130- run : |
131- python${PY_VER} setup.py build sdist
132- python${PY_VER} -m build --wheel
133- auditwheel repair dist/*.whl --wheel-dir dist/
120+ echo "Build Image: ${BUILD_IMAGE}"
121+ echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
122+ echo "BUILD_IMAGE=${BUILD_IMAGE}" >> $GITHUB_ENV
123+ mkdir dist
124+
125+ - name : Build Docker image
126+ uses : docker/build-push-action@v6
127+ env :
128+ CACHE_SPEC : " type=registry,ref=${{ env.BUILD_IMAGE }}-buildcache"
129+ with :
130+ context : .
131+ file : ./docker/Dockerfile.python_wheels
132+ build-args : |
133+ BASE_IMAGE=${{ env.BASE_IMAGE }}
134+ PY_VER=${{ env.PY_VER }}
135+ platforms : ${{ env.PLATFORMS }}
136+ push : false
137+ outputs : type=local,dest=./dist_out
138+ cache-from : ${{ env.CACHE_SPEC }}
139+ cache-to : ${{ env.CACHE_SPEC }},mode=max
140+
141+ - name : Show context tree
142+ run : ls -R .
134143
135144 - name : Publish package distributions to PyPI
136145 if : github.event_name == 'release' && github.event.action == 'created'
0 commit comments