|
1 |
| ---- |
2 |
| -name: Build Wheels on Release |
| 1 | +# This file is autogenerated by maturin v1.8.2 |
| 2 | +# To update, run |
| 3 | +# |
| 4 | +# maturin generate-ci github |
| 5 | +# |
| 6 | +name: build wheels |
| 7 | + |
3 | 8 | on:
|
| 9 | + push: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + - master |
| 13 | + tags: |
| 14 | + - "*" |
| 15 | + pull_request: |
| 16 | + workflow_dispatch: |
4 | 17 | release:
|
5 | 18 | types: [published]
|
6 | 19 |
|
7 | 20 | jobs:
|
8 |
| - build-wheels: |
9 |
| - runs-on: ${{ matrix.runner }} |
| 21 | + linux: |
| 22 | + runs-on: ${{ matrix.platform.runner }} |
10 | 23 | strategy:
|
11 | 24 | matrix:
|
12 |
| - include: |
13 |
| - # macos - ARM |
14 |
| - - os: macos-latest |
15 |
| - architecture: arm64 |
16 |
| - runner: macos-14 # m1 |
17 |
| - python-version: "3.12" |
18 |
| - - os: macos-latest |
19 |
| - architecture: arm64 |
20 |
| - runner: macos-14 # m1 |
21 |
| - python-version: "3.11" |
22 |
| - # macos - x86 |
23 |
| - - os: macos-latest |
24 |
| - architecture: x64 |
25 |
| - runner: macos-13 # x86 |
26 |
| - python-version: "3.12" |
27 |
| - - os: macos-latest |
28 |
| - architecture: x64 |
29 |
| - runner: macos-13 # x86 |
30 |
| - python-version: "3.11" |
31 |
| - # ubuntu - x86 |
32 |
| - - os: ubuntu-latest |
33 |
| - architecture: x64 |
34 |
| - runner: ubuntu-latest |
35 |
| - python-version: "3.11" |
36 |
| - - os: ubuntu-latest |
37 |
| - architecture: x64 |
38 |
| - runner: ubuntu-latest |
39 |
| - python-version: "3.12" |
40 |
| - fail-fast: false |
41 |
| - |
| 25 | + platform: |
| 26 | + - runner: ubuntu-22.04 |
| 27 | + target: x86_64 |
| 28 | + python-version: |
| 29 | + - "3.11" |
| 30 | + - "3.12" |
42 | 31 | steps:
|
43 |
| - - name: Checkout |
44 |
| - uses: actions/checkout@master |
45 |
| - |
46 |
| - - uses: actions-rs/toolchain@v1 |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + - name: Build wheels |
| 34 | + uses: PyO3/maturin-action@v1 |
47 | 35 | with:
|
48 |
| - profile: minimal |
49 |
| - toolchain: stable |
50 |
| - override: true |
51 |
| - |
52 |
| - # Setup Python for the selected version |
53 |
| - - name: Set up Python ${{ matrix.python-version }} |
54 |
| - uses: actions/setup-python@v4 |
| 36 | + target: ${{ matrix.platform.target }} |
| 37 | + args: --release --out dist --interpreter python-${{ matrix.python-version }} |
| 38 | + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 39 | + manylinux: auto |
| 40 | + - name: Upload wheels |
| 41 | + uses: actions/upload-artifact@v4 |
55 | 42 | with:
|
56 |
| - python-version: ${{ matrix.python-version }} |
57 |
| - architecture: ${{ matrix.architecture }} |
| 43 | + name: wheels-linux-${{ matrix.platform.target }}-${{ matrix.python-version }} |
| 44 | + path: dist |
58 | 45 |
|
59 |
| - # Install Rust toolchain |
60 |
| - - uses: actions-rs/toolchain@v1 |
| 46 | + macos: |
| 47 | + runs-on: ${{ matrix.platform.runner }} |
| 48 | + strategy: |
| 49 | + matrix: |
| 50 | + platform: |
| 51 | + - runner: macos-13 |
| 52 | + target: x86_64 |
| 53 | + - runner: macos-14 |
| 54 | + target: aarch64 |
| 55 | + python-version: |
| 56 | + - "3.11" |
| 57 | + - "3.12" |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + - name: Build wheels |
| 61 | + uses: PyO3/maturin-action@v1 |
61 | 62 | with:
|
62 |
| - profile: minimal |
63 |
| - toolchain: stable |
64 |
| - override: true |
| 63 | + target: ${{ matrix.platform.target }} |
| 64 | + args: --release --out dist --interpreter python-${{ matrix.python-version }} |
| 65 | + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 66 | + - name: Upload wheels |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: wheels-macos-${{ matrix.platform.target }}-${{ matrix.python-version }} |
| 70 | + path: dist |
65 | 71 |
|
66 |
| - - name: Install maturin |
67 |
| - run: | |
68 |
| - python -m venv venv |
69 |
| - . venv/bin/activate |
70 |
| - pip install maturin |
71 |
| - pip show maturin |
| 72 | + sdist: |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v4 |
| 76 | + - name: Build sdist |
| 77 | + uses: PyO3/maturin-action@v1 |
| 78 | + with: |
| 79 | + command: sdist |
| 80 | + args: --out dist |
| 81 | + - name: Upload sdist |
| 82 | + uses: actions/upload-artifact@v4 |
| 83 | + with: |
| 84 | + name: wheels-sdist |
| 85 | + path: dist |
72 | 86 |
|
73 |
| - - name: Add library to venv |
74 |
| - run: | |
75 |
| - . venv/bin/activate |
76 |
| - maturin develop --features=python |
| 87 | + upload-release: |
| 88 | + name: Upload release artifacts to GitHub |
| 89 | + needs: [linux, macos, sdist] |
| 90 | + runs-on: ubuntu-latest |
| 91 | + if: github.event.release.tag_name |
| 92 | + steps: |
| 93 | + - name: Download wheel artifacts |
| 94 | + uses: actions/download-artifact@v4 |
77 | 95 |
|
78 |
| - - name: Build wheels |
79 |
| - id: build_wheels |
80 |
| - run: | |
81 |
| - . venv/bin/activate |
82 |
| - maturin build --features=python --release --strip --manylinux=off |
| 96 | + - name: List downloaded wheels |
| 97 | + run: ls -l wheels-*/* |
83 | 98 |
|
84 |
| - - name: Upload wheel artifact |
85 |
| - uses: actions/upload-artifact@v3 |
| 99 | + - name: Upload Wheels to Release |
| 100 | + uses: svenstaro/upload-release-action@v2 |
86 | 101 | with:
|
87 |
| - name: wheel-${{ matrix.os }}-py${{ matrix.python-version }} |
88 |
| - path: target/wheels/*.whl |
| 102 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 103 | + file: wheels-*/** |
| 104 | + tag: ${{ github.event.release.tag_name }} |
| 105 | + file_glob: true |
89 | 106 |
|
90 |
| - upload-release: |
91 |
| - needs: [build-wheels] |
92 |
| - runs-on: ubuntu-latest |
93 |
| - steps: |
94 |
| - - name: Download wheel artifacts |
95 |
| - uses: actions/download-artifact@v3 |
96 |
| - with: |
97 |
| - path: ./wheels |
98 |
| - |
99 |
| - - name: List downloaded wheels |
100 |
| - run: ls -l wheels/* |
| 107 | + release: |
| 108 | + name: Release to PyPI |
| 109 | + runs-on: ubuntu-latest |
| 110 | + if: github.event.release.tag_name |
| 111 | + needs: [linux, macos, sdist] |
| 112 | + permissions: |
| 113 | + # Use to sign the release artifacts |
| 114 | + id-token: write |
| 115 | + # Used to upload release artifacts |
| 116 | + contents: write |
| 117 | + # Used to generate artifact attestation |
| 118 | + attestations: write |
| 119 | + steps: |
| 120 | + - uses: actions/download-artifact@v4 |
| 121 | + - name: Generate artifact attestation |
| 122 | + uses: actions/attest-build-provenance@v1 |
| 123 | + with: |
| 124 | + subject-path: "wheels-*/**" |
101 | 125 |
|
102 |
| - - name: Upload Wheels to Release |
103 |
| - uses: svenstaro/upload-release-action@v2 |
104 |
| - with: |
105 |
| - repo_token: ${{ secrets.GITHUB_TOKEN }} |
106 |
| - file: wheels/**/*.whl |
107 |
| - tag: ${{ github.event.release.tag_name }} |
108 |
| - file_glob: true |
| 126 | + - name: Publish to PyPI |
| 127 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 128 | + uses: PyO3/maturin-action@v1 |
| 129 | + env: |
| 130 | + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 131 | + with: |
| 132 | + command: upload |
| 133 | + args: --non-interactive --skip-existing wheels-*/** |
0 commit comments