|
6 | 6 | types: [published]
|
7 | 7 |
|
8 | 8 | jobs:
|
9 |
| - upload-pypi: |
10 |
| - permissions: |
11 |
| - id-token: write |
| 9 | + build: |
12 | 10 | runs-on: ubuntu-latest
|
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + platform: [native, aarch64, armv7l] |
| 15 | + python: [cp37, cp38, cp39, cp310, cp311, cp312, cp313] |
| 16 | + tag: [manylinux, musllinux] |
13 | 17 | steps:
|
14 |
| - - name: Set up Python |
15 |
| - uses: actions/setup-python@v5 |
16 |
| - with: |
17 |
| - python-version: 3.x |
18 |
| - |
19 | 18 | - name: Checkout Current Repo
|
20 | 19 | uses: actions/checkout@v4
|
21 | 20 | with:
|
22 | 21 | submodules: true
|
23 | 22 | fetch-depth: 0
|
24 | 23 |
|
| 24 | + - name: Set up Python |
| 25 | + uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + python-version: 3.x |
| 28 | + |
25 | 29 | - name: Install dependencies
|
| 30 | + if: matrix.platform == 'native' |
26 | 31 | run: |
|
27 | 32 | sudo apt install python3-dev
|
28 | 33 | python3 -m pip install --upgrade pip
|
29 | 34 | python3 -m pip install -r requirements.txt
|
30 |
| - python3 -m pip install twine |
31 | 35 |
|
32 | 36 | - name: Set up QEMU
|
| 37 | + if: matrix.platform != 'native' |
33 | 38 | uses: docker/setup-qemu-action@v3
|
| 39 | + with: |
| 40 | + # cached image is enabled by default. |
| 41 | + # This option to disable caching doesn't exist before docker/[email protected] |
| 42 | + # cache-image: false |
| 43 | + |
| 44 | + # NOTE: the default tag `tonistiigi/binfmt:latest` is old and uses qemu v6.2.0 |
| 45 | + # See also https://github.com/tonistiigi/binfmt/issues/215 |
| 46 | + image: docker.io/tonistiigi/binfmt:qemu-v8.1.5 |
34 | 47 |
|
35 | 48 | - name: Build wheels with cibuildwheels
|
36 | 49 |
|
37 | 50 | env:
|
38 |
| - CIBW_ARCHS_LINUX: aarch64 native armv7l |
39 |
| - CIBW_SKIP: cp36* pp* *ppc64le *s390x |
| 51 | + CIBW_ARCHS_LINUX: ${{ matrix.platform }} |
| 52 | + CIBW_SKIP: pp* *ppc64le *s390x |
| 53 | + CIBW_BUILD_VERBOSITY: 1 |
| 54 | + CIBW_BUILD: '${{ matrix.python }}*${{ matrix.tag }}*' |
40 | 55 |
|
41 | 56 | - name: Move cross-compiled wheels to dist folder
|
42 | 57 | run: |
|
43 | 58 | mkdir -p dist
|
44 | 59 | mv ./wheelhouse/*.whl ${{ github.workspace }}/dist/
|
45 | 60 |
|
46 | 61 | - name: build source distributable wheel
|
47 |
| - # sdist for non-supprted platforms will serve as a stub lib install |
| 62 | + # only need to do this once, preferably on a native build. |
| 63 | + if: matrix.platform == 'native' && matrix.python == 'cp313' && matrix.tag == 'manylinux' |
| 64 | + # sdist for non-supported platforms will serve as a stub lib install |
48 | 65 | run: |
|
49 | 66 | python -m pip install build
|
50 | 67 | python -m build -s
|
51 | 68 |
|
52 | 69 | - name: Save distributable wheels as artifacts
|
53 | 70 | uses: actions/upload-artifact@v4
|
54 | 71 | with:
|
55 |
| - name: "pyRF24_pkg_dist" |
| 72 | + name: pyRF24_pkg_dist_${{ matrix.platform }}_${{ matrix.python }}_${{ matrix.tag }} |
56 | 73 | path: ${{ github.workspace }}/dist
|
57 | 74 |
|
| 75 | + upload-pypi: |
| 76 | + needs: [build] |
| 77 | + permissions: |
| 78 | + id-token: write |
| 79 | + runs-on: ubuntu-latest |
| 80 | + steps: |
| 81 | + - name: Checkout Current Repo |
| 82 | + uses: actions/checkout@v4 |
| 83 | + |
| 84 | + - name: Set up Python |
| 85 | + uses: actions/setup-python@v5 |
| 86 | + with: |
| 87 | + python-version: 3.x |
| 88 | + |
| 89 | + - name: Download build artifacts |
| 90 | + uses: actions/download-artifact@v4 |
| 91 | + with: |
| 92 | + pattern: pyRF24_pkg_dist_* |
| 93 | + path: dist |
| 94 | + merge-multiple: true |
| 95 | + |
| 96 | + - name: Display uploaded distributions |
| 97 | + if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' |
| 98 | + run: ls -r dist/ |
| 99 | + |
58 | 100 | - name: Publish package (to TestPyPI)
|
59 |
| - if: github.event_name == 'workflow_dispatch' |
| 101 | + if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' |
60 | 102 |
|
61 | 103 | with:
|
62 | 104 | repository-url: https://test.pypi.org/legacy/
|
|
0 commit comments