Skip to content

Commit 7a43bf3

Browse files
committed
Use docker for manylinux workflow (cache issue)
1 parent 45241ca commit 7a43bf3

File tree

1 file changed

+55
-37
lines changed

1 file changed

+55
-37
lines changed

.github/workflows/manylinux.yml

Lines changed: 55 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,10 @@ jobs:
2525
- manylinux_2_28_x86_64
2626
- musllinux_1_2_x86_64
2727

28-
container: quay.io/pypa/${{ matrix.image }}
29-
3028
steps:
31-
- uses: actions/checkout@v1
32-
33-
- name: Install python build dependencies
34-
run: |
35-
# https://github.com/actions/runner/issues/2033
36-
chown -R $(id -u):$(id -g) $PWD
37-
/opt/python/${{ matrix.python-abi }}/bin/pip install --upgrade pip setuptools wheel build 'setuptools_scm>=8'
38-
39-
- name: Install system build dependencies (manylinux)
40-
if: contains(matrix.image, 'manylinux')
41-
run: |
42-
yum install -y perl-core
43-
44-
- name: Set environment variables
45-
shell: bash
46-
run: |
47-
PKGVER=$(/opt/python/${{ matrix.python-abi }}/bin/python setup.py --version)
48-
echo "PKGVER=$PKGVER"
49-
echo "PKGVER=$PKGVER" >> $GITHUB_ENV
29+
- uses: actions/checkout@v5.0.0
30+
with:
31+
fetch-depth: 0
5032

5133
- name: Cache [libs]
5234
uses: actions/cache/restore@v4.3.0
@@ -57,26 +39,62 @@ jobs:
5739
libs/*.zip
5840
key: libs-${{ runner.os }}-${{ runner.arch }}-${{ env.LIBXML2_VERSION }}-${{ env.LIBXSLT_VERSION }}
5941

60-
- name: Build linux_x86_64 wheel
42+
# Keep this job on the host runner so JS-based actions (for example actions/cache)
43+
# can run, then execute build/test inside the target manylinux/musllinux container.
44+
- name: Build and test in container
6145
env:
6246
PYXMLSEC_STATIC_DEPS: true
6347
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
PY_ABI: ${{ matrix.python-abi }}
49+
MANYLINUX_IMAGE: ${{ matrix.image }}
6450
run: |
65-
/opt/python/${{ matrix.python-abi }}/bin/python -m build
51+
set -euxo pipefail
52+
docker run --rm \
53+
-v "$PWD:$PWD" \
54+
-w "$PWD" \
55+
-e GH_TOKEN \
56+
-e PYXMLSEC_STATIC_DEPS \
57+
-e PYXMLSEC_LIBXML2_VERSION \
58+
-e PYXMLSEC_LIBXSLT_VERSION \
59+
-e PY_ABI \
60+
-e MANYLINUX_IMAGE \
61+
-e HOST_UID="$(id -u)" \
62+
-e HOST_GID="$(id -g)" \
63+
"quay.io/pypa/${MANYLINUX_IMAGE}" \
64+
sh -lc '
65+
set -eu
6666
67-
- name: Label manylinux wheel
68-
run: |
69-
ls -la dist/
70-
auditwheel show dist/xmlsec-${{ env.PKGVER }}-${{ matrix.python-abi }}-linux_x86_64.whl
71-
auditwheel repair dist/xmlsec-${{ env.PKGVER }}-${{ matrix.python-abi }}-linux_x86_64.whl
72-
ls -la wheelhouse/
73-
auditwheel show wheelhouse/xmlsec-${{ env.PKGVER }}-${{ matrix.python-abi }}-*${{ matrix.image }}*.whl
67+
# Step: Install system build dependencies (manylinux only)
68+
case "$MANYLINUX_IMAGE" in
69+
manylinux*)
70+
yum install -y perl-core
71+
;;
72+
esac
7473
75-
- name: Install test dependencies
76-
run: |
77-
/opt/python/${{ matrix.python-abi }}/bin/pip install --upgrade -r requirements-test.txt
78-
/opt/python/${{ matrix.python-abi }}/bin/pip install xmlsec --only-binary=xmlsec --no-index --find-links=wheelhouse/
74+
# Step: Install python build dependencies
75+
/opt/python/${PY_ABI}/bin/pip install --upgrade pip setuptools wheel build setuptools_scm\>=8
7976
80-
- name: Run tests
81-
run: |
82-
/opt/python/${{ matrix.python-abi }}/bin/pytest -v --color=yes
77+
# Step: Set environment variables
78+
PKGVER=$(/opt/python/${PY_ABI}/bin/python setup.py --version)
79+
echo "PKGVER=$PKGVER"
80+
81+
# Step: Build linux_x86_64 wheel
82+
/opt/python/${PY_ABI}/bin/python -m build
83+
84+
# Step: Label manylinux wheel
85+
ls -la dist/
86+
auditwheel show dist/xmlsec-${PKGVER}-${PY_ABI}-linux_x86_64.whl
87+
auditwheel repair dist/xmlsec-${PKGVER}-${PY_ABI}-linux_x86_64.whl
88+
ls -la wheelhouse/
89+
auditwheel show wheelhouse/xmlsec-${PKGVER}-${PY_ABI}-*${MANYLINUX_IMAGE}*.whl
90+
91+
# Step: Install test dependencies
92+
/opt/python/${PY_ABI}/bin/pip install --upgrade -r requirements-test.txt
93+
/opt/python/${PY_ABI}/bin/pip install xmlsec --only-binary=xmlsec --no-index --find-links=wheelhouse/
94+
95+
# Step: Run tests
96+
/opt/python/${PY_ABI}/bin/pytest -v --color=yes
97+
98+
# Step: Fix mounted workspace file ownership on host
99+
chown -R "${HOST_UID}:${HOST_GID}" dist wheelhouse build libs || true
100+
'

0 commit comments

Comments
 (0)