Skip to content

Commit 6fdf9e2

Browse files
robertlong13tridge
authored andcommitted
.github: build with matrix per Python version
1 parent 626528e commit 6fdf9e2

File tree

1 file changed

+53
-19
lines changed

1 file changed

+53
-19
lines changed

.github/workflows/python-publish.yml

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,51 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17-
deploy:
18-
19-
runs-on: ubuntu-latest
17+
wheels:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: ["ubuntu-latest"]
22+
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
23+
name: ${{ matrix.os }} ${{ matrix.python }}
24+
runs-on: ${{ matrix.os }}
2025

2126
steps:
2227
- uses: actions/checkout@v2
23-
- name: Set up Python
24-
uses: actions/setup-python@v2
25-
with:
26-
python-version: '3.9'
27-
- name: Install mavlink message
28+
- name: Install mavlink messages
2829
run: |
2930
git clone https://github.com/ArduPilot/mavlink.git
3031
ln -s $PWD/mavlink/message_definitions
32+
- name: Set CIBW_BUILD
33+
run: echo "CIBW_BUILD=cp${PYTHON/./}-*" >> $GITHUB_ENV
34+
env:
35+
PYTHON: ${{ matrix.python }}
3136
- name: Build wheels
3237
uses: pypa/[email protected]
3338
env:
34-
CIBW_SKIP: "cp36-* cp37-* pp*"
3539
CIBW_BEFORE_BUILD_LINUX: >
3640
if [ "$(uname -m)" = "i686" ] && grep -q musl /lib/libc.musl-*; then
3741
apk add --no-cache libxml2-dev libxslt-dev;
3842
fi
39-
- name: Check existence of at least one wheel
40-
run: |
41-
if [ ! -d wheelhouse ] || [ -z "$(ls -A wheelhouse/*.whl 2>/dev/null)" ]; then
42-
echo "No wheels found in wheelhouse"
43-
exit 1
44-
fi
45-
- name: Move wheels to dist
43+
- name: Upload wheels
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: wheels-${{ matrix.os }}-cp${{ matrix.python }}
47+
path: wheelhouse/*.whl
48+
if-no-files-found: error
49+
50+
sdist:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v2
54+
- name: Set up Python
55+
uses: actions/setup-python@v2
56+
with:
57+
python-version: "3.9"
58+
- name: Install mavlink messages
4659
run: |
47-
mkdir -p dist
48-
cp wheelhouse/* dist/
60+
git clone https://github.com/ArduPilot/mavlink.git
61+
ln -s $PWD/mavlink/message_definitions
4962
- name: Install dependencies
5063
run: |
5164
python3 -m pip install -U pip
@@ -54,12 +67,33 @@ jobs:
5467
python3 -m pip install -U .
5568
- name: Build sdist
5669
run: pipx run build --sdist
57-
- name: Upload artifacts
70+
- name: Upload sdist
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: sdist
74+
path: dist/*.tar.gz
75+
if-no-files-found: error
76+
77+
publish:
78+
needs: [wheels, sdist]
79+
runs-on: ubuntu-latest
80+
steps:
81+
- name: Download all artifacts
82+
uses: actions/download-artifact@v4
83+
with:
84+
path: dist
85+
merge-multiple: true
86+
87+
- name: Verify dist contents
88+
run: ls -lh dist/
89+
90+
- name: Upload final dist artifact
5891
uses: actions/upload-artifact@v4
5992
with:
6093
name: dist
6194
path: dist/*
6295
if-no-files-found: error
96+
6397
- name: Publish package
6498
if: github.event_name == 'release' && github.event.action == 'published'
6599
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)