|
3 | 3 | #
|
4 | 4 | # maturin generate-ci github
|
5 | 5 | #
|
6 |
| -name: Build and Publish |
| 6 | + |
| 7 | +name: CI |
7 | 8 |
|
8 | 9 | on:
|
9 | 10 | push:
|
10 | 11 | branches:
|
11 | 12 | - main
|
| 13 | + - master |
| 14 | + tags: |
| 15 | + - '*' |
12 | 16 | pull_request:
|
13 |
| - branches: |
14 |
| - - main |
| 17 | + workflow_dispatch: |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
15 | 21 |
|
16 | 22 | jobs:
|
17 |
| - build: |
18 |
| - runs-on: ${{ matrix.os }} |
| 23 | + linux: |
| 24 | + runs-on: ${{ matrix.platform.runner }} |
19 | 25 | strategy:
|
20 | 26 | matrix:
|
21 |
| - os: [ubuntu-latest, macos-latest, windows-latest] |
22 |
| - |
| 27 | + platform: |
| 28 | + - runner: ubuntu-latest |
| 29 | + target: x86_64 |
| 30 | + - runner: ubuntu-latest |
| 31 | + target: x86 |
| 32 | + - runner: ubuntu-latest |
| 33 | + target: aarch64 |
| 34 | + - runner: ubuntu-latest |
| 35 | + target: armv7 |
| 36 | + - runner: ubuntu-latest |
| 37 | + target: s390x |
| 38 | + - runner: ubuntu-latest |
| 39 | + target: ppc64le |
23 | 40 | steps:
|
24 |
| - - uses: actions/checkout@v2 |
25 |
| - |
26 |
| - - name: Set up Python |
27 |
| - uses: actions/setup-python@v2 |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + - uses: actions/setup-python@v5 |
28 | 43 | with:
|
29 |
| - python-version: 3.9 # Use any version >=3.6 for the build |
30 |
| - |
31 |
| - - name: Install Rust |
32 |
| - uses: actions-rs/toolchain@v1 |
| 44 | + python-version: '3.10' |
| 45 | + - name: Build wheels |
| 46 | + uses: PyO3/maturin-action@v1 |
33 | 47 | with:
|
34 |
| - toolchain: stable |
35 |
| - profile: minimal |
36 |
| - override: true |
37 |
| - |
38 |
| - - name: Install maturin |
39 |
| - run: pip install maturin |
| 48 | + target: ${{ matrix.platform.target }} |
| 49 | + args: --release --out dist --find-interpreter --bindings pyo3-abi3 |
| 50 | + sccache: 'true' |
| 51 | + manylinux: auto |
| 52 | + - name: Upload wheels |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: wheels-linux-${{ matrix.platform.target }} |
| 56 | + path: dist |
40 | 57 |
|
| 58 | + windows: |
| 59 | + runs-on: ${{ matrix.platform.runner }} |
| 60 | + strategy: |
| 61 | + matrix: |
| 62 | + platform: |
| 63 | + - runner: windows-latest |
| 64 | + target: x64 |
| 65 | + - runner: windows-latest |
| 66 | + target: x86 |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v4 |
| 69 | + - uses: actions/setup-python@v5 |
| 70 | + with: |
| 71 | + python-version: '3.10' |
| 72 | + architecture: ${{ matrix.platform.target }} |
41 | 73 | - name: Build wheels
|
42 |
| - run: maturin build --release --strip |
| 74 | + uses: PyO3/maturin-action@v1 |
| 75 | + with: |
| 76 | + target: ${{ matrix.platform.target }} |
| 77 | + args: --release --out dist --find-interpreter --bindings pyo3-abi3 |
| 78 | + sccache: 'true' |
| 79 | + - name: Upload wheels |
| 80 | + uses: actions/upload-artifact@v4 |
| 81 | + with: |
| 82 | + name: wheels-windows-${{ matrix.platform.target }} |
| 83 | + path: dist |
43 | 84 |
|
44 |
| - - name: Upload artifact |
45 |
| - uses: actions/upload-artifact@v2 |
| 85 | + macos: |
| 86 | + runs-on: ${{ matrix.platform.runner }} |
| 87 | + strategy: |
| 88 | + matrix: |
| 89 | + platform: |
| 90 | + - runner: macos-latest |
| 91 | + target: x86_64 |
| 92 | + - runner: macos-14 |
| 93 | + target: aarch64 |
| 94 | + steps: |
| 95 | + - uses: actions/checkout@v4 |
| 96 | + - uses: actions/setup-python@v5 |
46 | 97 | with:
|
47 |
| - name: wheels |
48 |
| - path: target/wheels/*.whl |
| 98 | + python-version: '3.10' |
| 99 | + - name: Build wheels |
| 100 | + uses: PyO3/maturin-action@v1 |
| 101 | + with: |
| 102 | + target: ${{ matrix.platform.target }} |
| 103 | + args: --release --out dist --find-interpreter --bindings pyo3-abi3 |
| 104 | + sccache: 'true' |
| 105 | + - name: Upload wheels |
| 106 | + uses: actions/upload-artifact@v4 |
| 107 | + with: |
| 108 | + name: wheels-macos-${{ matrix.platform.target }} |
| 109 | + path: dist |
49 | 110 |
|
50 |
| - publish: |
51 |
| - needs: build |
| 111 | + sdist: |
52 | 112 | runs-on: ubuntu-latest
|
53 | 113 | steps:
|
54 |
| - - uses: actions/checkout@v2 |
55 |
| - |
56 |
| - - name: Download artifact |
57 |
| - uses: actions/download-artifact@v2 |
| 114 | + - uses: actions/checkout@v4 |
| 115 | + - name: Build sdist |
| 116 | + uses: PyO3/maturin-action@v1 |
58 | 117 | with:
|
59 |
| - name: wheels |
| 118 | + command: sdist |
| 119 | + args: --out dist --bindings pyo3-abi3 |
| 120 | + - name: Upload sdist |
| 121 | + uses: actions/upload-artifact@v4 |
| 122 | + with: |
| 123 | + name: wheels-sdist |
60 | 124 | path: dist
|
61 | 125 |
|
62 |
| - - name: Set up Python |
63 |
| - uses: actions/setup-python@v2 |
| 126 | + release: |
| 127 | + name: Release |
| 128 | + runs-on: ubuntu-latest |
| 129 | + if: "startsWith(github.ref, 'refs/tags/')" |
| 130 | + needs: [linux, windows, macos, sdist] |
| 131 | + steps: |
| 132 | + - uses: actions/download-artifact@v4 |
64 | 133 | with:
|
65 |
| - python-version: 3.x |
66 |
| - |
67 |
| - - name: Install twine |
68 |
| - run: pip install twine |
69 |
| - |
| 134 | + name: wheels-linux-x86_64 |
| 135 | + - uses: actions/download-artifact@v4 |
| 136 | + with: |
| 137 | + name: wheels-windows-x64 |
| 138 | + - uses: actions/download-artifact@v4 |
| 139 | + with: |
| 140 | + name: wheels-macos-x86_64 |
70 | 141 | - name: Publish to PyPI
|
71 |
| - run: twine upload dist/* |
| 142 | + uses: PyO3/maturin-action@v1 |
72 | 143 | env:
|
73 |
| - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
74 |
| - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
| 144 | + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 145 | + with: |
| 146 | + command: upload |
| 147 | + args: --non-interactive --skip-existing wheels-*/* |
0 commit comments