|
7 | 7 | workflow_dispatch: |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - build: |
11 | | - name: Build distributions on ${{ matrix.os }} (Python ${{ matrix.python-version }}) |
| 10 | + build_wheels: |
| 11 | + name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.python }} |
12 | 12 | runs-on: ${{ matrix.os }} |
13 | 13 | strategy: |
| 14 | + fail-fast: false |
14 | 15 | matrix: |
15 | | - os: [ubuntu-latest, windows-latest] |
16 | | - python-version: ['3.10', '3.11', '3.12'] |
| 16 | + include: |
| 17 | + # Linux x86_64 |
| 18 | + - os: ubuntu-latest |
| 19 | + python: cp310 |
| 20 | + arch: x86_64 |
| 21 | + - os: ubuntu-latest |
| 22 | + python: cp311 |
| 23 | + arch: x86_64 |
| 24 | + - os: ubuntu-latest |
| 25 | + python: cp312 |
| 26 | + arch: x86_64 |
| 27 | + - os: ubuntu-latest |
| 28 | + python: cp313 |
| 29 | + arch: x86_64 |
| 30 | + # Linux aarch64 |
| 31 | + - os: ubuntu-latest |
| 32 | + python: cp310 |
| 33 | + arch: aarch64 |
| 34 | + - os: ubuntu-latest |
| 35 | + python: cp311 |
| 36 | + arch: aarch64 |
| 37 | + - os: ubuntu-latest |
| 38 | + python: cp312 |
| 39 | + arch: aarch64 |
| 40 | + - os: ubuntu-latest |
| 41 | + python: cp313 |
| 42 | + arch: aarch64 |
| 43 | + # Windows |
| 44 | + - os: windows-latest |
| 45 | + python: cp310 |
| 46 | + arch: AMD64 |
| 47 | + - os: windows-latest |
| 48 | + python: cp311 |
| 49 | + arch: AMD64 |
| 50 | + - os: windows-latest |
| 51 | + python: cp312 |
| 52 | + arch: AMD64 |
| 53 | + - os: windows-latest |
| 54 | + python: cp313 |
| 55 | + arch: AMD64 |
| 56 | + |
17 | 57 | steps: |
18 | | - - name: Checkout |
19 | | - uses: actions/checkout@v4 |
| 58 | + - uses: actions/checkout@v4 |
20 | 59 | with: |
21 | 60 | submodules: true |
22 | 61 |
|
23 | | - - name: Install dependencies (Linux) |
24 | | - if: runner.os == 'Linux' |
25 | | - run: | |
26 | | - sudo apt-get update |
27 | | - sudo apt-get install -y \ |
28 | | - libglm-dev libglfw3-dev libpng-dev libjpeg-dev libeigen3-dev |
| 62 | + - name: Docker login |
| 63 | + continue-on-error: true |
| 64 | + uses: docker/login-action@v1 |
| 65 | + with: |
| 66 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 67 | + password: ${{ secrets.DOCKER_TOKEN }} |
| 68 | + |
| 69 | + - name: Set up QEMU |
| 70 | + if: matrix.arch == 'aarch64' |
| 71 | + uses: docker/setup-qemu-action@v3 |
29 | 72 |
|
30 | | - - name: Set up Python |
31 | | - uses: actions/setup-python@v4 |
| 73 | + - name: Build wheels |
| 74 | + |
| 75 | + env: |
| 76 | + CIBW_BUILD: ${{ matrix.python }}-* |
| 77 | + CIBW_ARCHS: ${{ matrix.arch }} |
| 78 | + |
| 79 | + - uses: actions/upload-artifact@v4 |
32 | 80 | with: |
33 | | - python-version: ${{ matrix.python-version }} |
34 | | - cache: 'pip' |
| 81 | + name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.python }} |
| 82 | + path: ./wheelhouse/*.whl |
35 | 83 |
|
36 | | - - name: Upgrade pip and install build deps |
37 | | - run: | |
38 | | - python -m pip install --upgrade pip |
39 | | - pip install build setuptools scikit-build scikit-build-core pybind11 |
| 84 | + build_sdist: |
| 85 | + name: Build source distribution |
| 86 | + runs-on: ubuntu-latest |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + with: |
| 90 | + submodules: true |
40 | 91 |
|
41 | | - - name: Build sdist and wheel |
42 | | - run: | |
43 | | - python -m build --sdist --wheel -n |
| 92 | + - name: Build sdist |
| 93 | + run: pipx run build --sdist |
44 | 94 |
|
45 | | - - name: Upload built distributions as artifact |
46 | | - uses: actions/upload-artifact@v4 |
| 95 | + - uses: actions/upload-artifact@v4 |
47 | 96 | with: |
48 | | - name: dist-${{ matrix.os }}-${{ matrix.python-version }} |
49 | | - path: dist/* |
| 97 | + name: cibw-sdist |
| 98 | + path: dist/*.tar.gz |
50 | 99 |
|
51 | 100 | publish: |
52 | 101 | name: Publish to PyPI |
| 102 | + needs: [build_wheels, build_sdist] |
53 | 103 | runs-on: ubuntu-latest |
54 | | - needs: build |
55 | 104 | if: startsWith(github.ref, 'refs/tags/v') |
56 | 105 | steps: |
57 | | - - name: Download build artifacts |
58 | | - uses: actions/download-artifact@v4 |
| 106 | + - uses: actions/download-artifact@v4 |
59 | 107 | with: |
60 | | - # download all artifacts produced by the build job |
61 | | - path: downloaded_artifacts |
62 | | - |
63 | | - - name: Collect distributions into dist/ |
64 | | - run: | |
65 | | - mkdir -p dist |
66 | | - find downloaded_artifacts -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec cp {} dist/ \; |
67 | | -
|
68 | | - - name: Show collected files |
69 | | - run: ls -la dist || true |
| 108 | + pattern: cibw-* |
| 109 | + path: dist |
| 110 | + merge-multiple: true |
70 | 111 |
|
71 | | - - name: Install twine |
72 | | - run: python -m pip install --upgrade pip twine |
73 | | - |
74 | | - - name: Publish to PyPI via Twine |
75 | | - env: |
76 | | - TWINE_USERNAME: __token__ |
77 | | - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
78 | | - run: | |
79 | | - python -m pip install --upgrade twine |
80 | | - # twine check may warn but won't block publishing here |
81 | | - twine check dist/* || true |
82 | | - twine upload --non-interactive -u "$TWINE_USERNAME" -p "$TWINE_PASSWORD" dist/* |
| 112 | + - name: Publish to PyPI |
| 113 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 114 | + with: |
| 115 | + user: __token__ |
| 116 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments