|
5 | 5 |
|
6 | 6 | name: Publish Python bindings
|
7 | 7 |
|
| 8 | +env: |
| 9 | + MIN_PYTHON_VERSION: 3.9 |
| 10 | + |
8 | 11 | jobs:
|
9 |
| - build-wheels: |
10 |
| - runs-on: ${{ matrix.os }} |
| 12 | + macos-wheels: |
| 13 | + runs-on: macos-latest |
11 | 14 | strategy:
|
| 15 | + fail-fast: false |
12 | 16 | matrix:
|
13 |
| - include: |
14 |
| - - os: macos-latest |
15 |
| - python-arch: x64 |
16 |
| - rust-target: x86_64 |
17 |
| - - os: macos-latest |
18 |
| - python-arch: x64 |
19 |
| - rust-target: universal2-apple-darwin |
20 |
| - - os: ubuntu-latest |
21 |
| - python-arch: x64 |
22 |
| - rust-target: x86_64 |
23 |
| - - os: ubuntu-latest |
24 |
| - python-arch: x64 |
25 |
| - rust-target: i686 |
26 |
| - skip-wheel-installation: true |
27 |
| - - os: windows-latest |
28 |
| - python-arch: x64 |
29 |
| - rust-target: x64 |
30 |
| - - os: windows-latest |
31 |
| - python-arch: x86 |
32 |
| - rust-target: x86 |
| 17 | + target: [x86_64, aarch64] |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + - uses: actions/setup-python@v5 |
| 21 | + with: |
| 22 | + python-version: ${{ env.MIN_PYTHON_VERSION }} |
| 23 | + - name: Build wheels |
| 24 | + uses: PyO3/maturin-action@v1 |
| 25 | + with: |
| 26 | + target: ${{ matrix.target }} |
| 27 | + args: --release --out dist |
| 28 | + sccache: 'true' |
| 29 | + - name: Test wheel installation |
| 30 | + if: matrix.target == 'x86_64' |
| 31 | + run: | |
| 32 | + pip install accesskit --no-index --find-links dist --force-reinstall |
| 33 | + python -c "import accesskit" |
| 34 | + - name: Upload wheels |
| 35 | + uses: actions/upload-artifact@v3 |
| 36 | + with: |
| 37 | + name: wheels |
| 38 | + path: dist |
33 | 39 |
|
| 40 | + unix-wheels: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + strategy: |
| 43 | + fail-fast: false |
| 44 | + matrix: |
| 45 | + target: [x86_64, x86, aarch64] |
34 | 46 | steps:
|
35 | 47 | - uses: actions/checkout@v3
|
36 |
| - - uses: actions/setup-python@v4 |
| 48 | + - uses: actions/setup-python@v5 |
37 | 49 | with:
|
38 |
| - python-version: 3.7 |
39 |
| - architecture: ${{ matrix.python-arch }} |
40 |
| - - uses: dtolnay/rust-toolchain@stable |
41 |
| - - name: Build wheel |
| 50 | + python-version: ${{ env.MIN_PYTHON_VERSION }} |
| 51 | + - name: Build wheels |
42 | 52 | uses: PyO3/maturin-action@v1
|
43 | 53 | with:
|
44 |
| - target: ${{ matrix.rust-target }} |
| 54 | + target: ${{ matrix.target }} |
| 55 | + args: --release --out dist |
| 56 | + sccache: 'true' |
45 | 57 | manylinux: auto
|
46 |
| - args: --release --out dist --sdist |
47 | 58 | - name: Test wheel installation
|
48 |
| - if: matrix.skip-wheel-installation != true |
| 59 | + if: matrix.target == 'x86_64' |
| 60 | + run: | |
| 61 | + pip install accesskit --no-index --find-links dist --force-reinstall |
| 62 | + python -c "import accesskit" |
| 63 | + - name: Upload wheels |
| 64 | + uses: actions/upload-artifact@v3 |
| 65 | + with: |
| 66 | + name: wheels |
| 67 | + path: dist |
| 68 | + |
| 69 | + windows-wheels: |
| 70 | + runs-on: windows-latest |
| 71 | + strategy: |
| 72 | + fail-fast: false |
| 73 | + matrix: |
| 74 | + target: [x64, x86] |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v3 |
| 77 | + - uses: actions/setup-python@v5 |
| 78 | + with: |
| 79 | + python-version: ${{ env.MIN_PYTHON_VERSION }} |
| 80 | + architecture: ${{ matrix.target }} |
| 81 | + - name: Build wheels |
| 82 | + uses: PyO3/maturin-action@v1 |
| 83 | + with: |
| 84 | + target: ${{ matrix.target }} |
| 85 | + args: --release --out dist |
| 86 | + sccache: 'true' |
| 87 | + - name: Test wheel installation |
49 | 88 | run: |
|
50 | 89 | pip install accesskit --no-index --find-links dist --force-reinstall
|
51 | 90 | python -c "import accesskit"
|
52 |
| - - name: Upload wheel |
| 91 | + - name: Upload wheels |
| 92 | + uses: actions/upload-artifact@v3 |
| 93 | + with: |
| 94 | + name: wheels |
| 95 | + path: dist |
| 96 | + |
| 97 | + sdist: |
| 98 | + runs-on: ubuntu-latest |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v3 |
| 101 | + - name: Build sdist |
| 102 | + uses: PyO3/maturin-action@v1 |
| 103 | + with: |
| 104 | + command: sdist |
| 105 | + args: --out dist |
| 106 | + - name: Upload sdist |
53 | 107 | uses: actions/upload-artifact@v3
|
54 | 108 | with:
|
55 | 109 | name: wheels
|
56 | 110 | path: dist
|
57 | 111 |
|
58 |
| - release: |
59 |
| - name: Release |
| 112 | + pypi-release: |
| 113 | + name: Publish to PyPI |
| 114 | + if: "startsWith(github.ref, 'refs/tags/')" |
| 115 | + needs: [macos-wheels, unix-wheels, windows-wheels, sdist] |
60 | 116 | runs-on: ubuntu-latest
|
| 117 | + steps: |
| 118 | + - uses: actions/download-artifact@v3 |
| 119 | + with: |
| 120 | + name: wheels |
| 121 | + - uses: PyO3/maturin-action@v1 |
| 122 | + env: |
| 123 | + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} |
| 124 | + with: |
| 125 | + command: upload |
| 126 | + args: --non-interactive --skip-existing * |
| 127 | + |
| 128 | + github-release: |
| 129 | + name: Add to GitHub release |
61 | 130 | if: "startsWith(github.ref, 'refs/tags/')"
|
62 |
| - needs: [build-wheels] |
| 131 | + needs: [macos-wheels, unix-wheels, windows-wheels, sdist] |
| 132 | + runs-on: ubuntu-latest |
63 | 133 | steps:
|
64 | 134 | - uses: actions/download-artifact@v3
|
65 | 135 | with:
|
66 | 136 | name: wheels
|
67 |
| - - uses: actions/setup-python@v4 |
| 137 | + path: dist |
| 138 | + |
| 139 | + |
68 | 140 | with:
|
69 |
| - python-version: 3.9 |
70 |
| - - name: Publish to PyPI |
71 |
| - env: |
72 |
| - TWINE_USERNAME: __token__ |
73 |
| - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
74 |
| - run: | |
75 |
| - pip install --upgrade twine |
76 |
| - twine upload --skip-existing * |
| 141 | + files: "dist/*" |
| 142 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 143 | + release-tag: ${{ github.ref_name }} |
0 commit comments