|
1 |
| -# This file is autogenerated by maturin v1.8.6 |
2 |
| -# To update, run |
3 |
| -# |
4 |
| -# maturin generate-ci github --pytest |
5 |
| -# |
6 | 1 | name: CI
|
7 | 2 |
|
8 | 3 | on:
|
| 4 | + # Trigger the workflow on push to main or dev, except tag creation |
9 | 5 | push:
|
10 | 6 | branches:
|
11 |
| - - main |
12 |
| - - master |
13 |
| - tags: |
14 |
| - - '*' |
15 |
| - pull_request: |
16 |
| - workflow_dispatch: |
17 |
| - |
18 |
| -permissions: |
19 |
| - contents: read |
| 7 | + - 'main' |
| 8 | + - 'dev' |
| 9 | + # Trigger the workflow on pull request |
| 10 | + pull_request: ~ |
| 11 | + # Trigger the workflow manually |
| 12 | + workflow_dispatch: ~ |
| 13 | + # Trigger after public PR approved for CI |
| 14 | + pull_request_target: |
| 15 | + types: [labeled] |
| 16 | + release: |
| 17 | + types: [created] |
20 | 18 |
|
21 | 19 | jobs:
|
22 |
| - linux: |
23 |
| - runs-on: ${{ matrix.platform.runner }} |
24 |
| - strategy: |
25 |
| - matrix: |
26 |
| - platform: |
27 |
| - - runner: ubuntu-22.04 |
28 |
| - target: x86_64 |
29 |
| - - runner: ubuntu-22.04 |
30 |
| - target: x86 |
31 |
| - - runner: ubuntu-22.04 |
32 |
| - target: aarch64 |
33 |
| - - runner: ubuntu-22.04 |
34 |
| - target: armv7 |
35 |
| - - runner: ubuntu-22.04 |
36 |
| - target: s390x |
37 |
| - - runner: ubuntu-22.04 |
38 |
| - target: ppc64le |
39 |
| - steps: |
40 |
| - - uses: actions/checkout@v4 |
41 |
| - - uses: actions/setup-python@v5 |
42 |
| - with: |
43 |
| - python-version: 3.x |
44 |
| - - name: Build wheels |
45 |
| - uses: PyO3/maturin-action@v1 |
46 |
| - with: |
47 |
| - target: ${{ matrix.platform.target }} |
48 |
| - args: --release --out dist --find-interpreter |
49 |
| - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
50 |
| - manylinux: auto |
51 |
| - - name: Upload wheels |
52 |
| - uses: actions/upload-artifact@v4 |
53 |
| - with: |
54 |
| - name: wheels-linux-${{ matrix.platform.target }} |
55 |
| - path: dist |
56 |
| - - name: pytest |
57 |
| - if: ${{ startsWith(matrix.platform.target, 'x86_64') }} |
58 |
| - shell: bash |
59 |
| - run: | |
60 |
| - set -e |
61 |
| - python3 -m venv .venv |
62 |
| - source .venv/bin/activate |
63 |
| - pip install polyshell --find-links dist --force-reinstall |
64 |
| - pip install pytest |
65 |
| - pytest |
66 |
| - - name: pytest |
67 |
| - if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }} |
68 |
| - uses: uraimo/run-on-arch-action@v2 |
69 |
| - with: |
70 |
| - arch: ${{ matrix.platform.target }} |
71 |
| - distro: ubuntu22.04 |
72 |
| - githubToken: ${{ github.token }} |
73 |
| - install: | |
74 |
| - apt-get update |
75 |
| - apt-get install -y --no-install-recommends python3 python3-pip |
76 |
| - pip3 install -U pip pytest |
77 |
| - run: | |
78 |
| - set -e |
79 |
| - pip3 install polyshell --find-links dist --force-reinstall |
80 |
| - pytest |
81 |
| -
|
82 |
| - musllinux: |
83 |
| - runs-on: ${{ matrix.platform.runner }} |
84 |
| - strategy: |
85 |
| - matrix: |
86 |
| - platform: |
87 |
| - - runner: ubuntu-22.04 |
88 |
| - target: x86_64 |
89 |
| - - runner: ubuntu-22.04 |
90 |
| - target: x86 |
91 |
| - - runner: ubuntu-22.04 |
92 |
| - target: aarch64 |
93 |
| - - runner: ubuntu-22.04 |
94 |
| - target: armv7 |
95 |
| - steps: |
96 |
| - - uses: actions/checkout@v4 |
97 |
| - - uses: actions/setup-python@v5 |
98 |
| - with: |
99 |
| - python-version: 3.x |
100 |
| - - name: Build wheels |
101 |
| - uses: PyO3/maturin-action@v1 |
102 |
| - with: |
103 |
| - target: ${{ matrix.platform.target }} |
104 |
| - args: --release --out dist --find-interpreter |
105 |
| - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
106 |
| - manylinux: musllinux_1_2 |
107 |
| - - name: Upload wheels |
108 |
| - uses: actions/upload-artifact@v4 |
109 |
| - with: |
110 |
| - name: wheels-musllinux-${{ matrix.platform.target }} |
111 |
| - path: dist |
112 |
| - - name: pytest |
113 |
| - if: ${{ startsWith(matrix.platform.target, 'x86_64') }} |
114 |
| - uses: addnab/docker-run-action@v3 |
115 |
| - with: |
116 |
| - image: alpine:latest |
117 |
| - options: -v ${{ github.workspace }}:/io -w /io |
118 |
| - run: | |
119 |
| - set -e |
120 |
| - apk add py3-pip py3-virtualenv |
121 |
| - python3 -m virtualenv .venv |
122 |
| - source .venv/bin/activate |
123 |
| - pip install polyshell --no-index --find-links dist --force-reinstall |
124 |
| - pip install pytest |
125 |
| - pytest |
126 |
| - - name: pytest |
127 |
| - if: ${{ !startsWith(matrix.platform.target, 'x86') }} |
128 |
| - uses: uraimo/run-on-arch-action@v2 |
129 |
| - with: |
130 |
| - arch: ${{ matrix.platform.target }} |
131 |
| - distro: alpine_latest |
132 |
| - githubToken: ${{ github.token }} |
133 |
| - install: | |
134 |
| - apk add py3-virtualenv |
135 |
| - run: | |
136 |
| - set -e |
137 |
| - python3 -m virtualenv .venv |
138 |
| - source .venv/bin/activate |
139 |
| - pip install pytest |
140 |
| - pip install polyshell --find-links dist --force-reinstall |
141 |
| - pytest |
142 |
| -
|
143 |
| - windows: |
144 |
| - runs-on: ${{ matrix.platform.runner }} |
145 |
| - strategy: |
146 |
| - matrix: |
147 |
| - platform: |
148 |
| - - runner: windows-latest |
149 |
| - target: x64 |
150 |
| - - runner: windows-latest |
151 |
| - target: x86 |
| 20 | + qa: |
| 21 | + name: qa |
| 22 | + runs-on: ubuntu-latest |
| 23 | + |
152 | 24 | steps:
|
153 |
| - - uses: actions/checkout@v4 |
154 |
| - - uses: actions/setup-python@v5 |
155 |
| - with: |
156 |
| - python-version: 3.x |
157 |
| - architecture: ${{ matrix.platform.target }} |
158 |
| - - name: Build wheels |
159 |
| - uses: PyO3/maturin-action@v1 |
| 25 | + - name: Checkout Repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Setup Rust toolchain |
| 29 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
160 | 30 | with:
|
161 |
| - target: ${{ matrix.platform.target }} |
162 |
| - args: --release --out dist --find-interpreter |
163 |
| - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
164 |
| - - name: Upload wheels |
165 |
| - uses: actions/upload-artifact@v4 |
| 31 | + components: rustfmt |
| 32 | + |
| 33 | + - name: Check formatting |
| 34 | + uses: actions-rust-lang/rustfmt@v1 |
| 35 | + |
| 36 | + - name: Install uv |
| 37 | + uses: astral-sh/setup-uv@v5 |
166 | 38 | with:
|
167 |
| - name: wheels-windows-${{ matrix.platform.target }} |
168 |
| - path: dist |
169 |
| - - name: pytest |
170 |
| - if: ${{ !startsWith(matrix.platform.target, 'aarch64') }} |
171 |
| - shell: bash |
172 |
| - run: | |
173 |
| - set -e |
174 |
| - python3 -m venv .venv |
175 |
| - source .venv/Scripts/activate |
176 |
| - pip install polyshell --find-links dist --force-reinstall |
177 |
| - pip install pytest |
178 |
| - pytest |
179 |
| -
|
180 |
| - macos: |
181 |
| - runs-on: ${{ matrix.platform.runner }} |
| 39 | + version: "0.7.3" |
| 40 | + |
| 41 | + - name: Install Python |
| 42 | + run: uv python install |
| 43 | + |
| 44 | + - name: Install the project |
| 45 | + run: uv sync --locked --all-extras --dev |
| 46 | + |
| 47 | + - name: Check isort |
| 48 | + run: uvx ruff check --select I . |
| 49 | + |
| 50 | + - name: Check formatting |
| 51 | + run: uvx ruff format --diff . |
| 52 | + |
| 53 | + - name: Check linting |
| 54 | + run: uvx ruff check . |
| 55 | + |
| 56 | + pytest: |
| 57 | + name: pytest |
| 58 | + needs: |
| 59 | + - qa |
182 | 60 | strategy:
|
| 61 | + fail-fast: false |
183 | 62 | matrix:
|
184 |
| - platform: |
185 |
| - - runner: macos-13 |
186 |
| - target: x86_64 |
187 |
| - - runner: macos-14 |
188 |
| - target: aarch64 |
189 |
| - steps: |
190 |
| - - uses: actions/checkout@v4 |
191 |
| - - uses: actions/setup-python@v5 |
192 |
| - with: |
193 |
| - python-version: 3.x |
194 |
| - - name: Build wheels |
195 |
| - uses: PyO3/maturin-action@v1 |
196 |
| - with: |
197 |
| - target: ${{ matrix.platform.target }} |
198 |
| - args: --release --out dist --find-interpreter |
199 |
| - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
200 |
| - - name: Upload wheels |
201 |
| - uses: actions/upload-artifact@v4 |
202 |
| - with: |
203 |
| - name: wheels-macos-${{ matrix.platform.target }} |
204 |
| - path: dist |
205 |
| - - name: pytest |
206 |
| - run: | |
207 |
| - set -e |
208 |
| - python3 -m venv .venv |
209 |
| - source .venv/bin/activate |
210 |
| - pip install polyshell --find-links dist --force-reinstall |
211 |
| - pip install pytest |
212 |
| - pytest |
213 |
| -
|
214 |
| - sdist: |
215 |
| - runs-on: ubuntu-latest |
216 |
| - steps: |
217 |
| - - uses: actions/checkout@v4 |
218 |
| - - name: Build sdist |
219 |
| - uses: PyO3/maturin-action@v1 |
220 |
| - with: |
221 |
| - command: sdist |
222 |
| - args: --out dist |
223 |
| - - name: Upload sdist |
224 |
| - uses: actions/upload-artifact@v4 |
225 |
| - with: |
226 |
| - name: wheels-sdist |
227 |
| - path: dist |
| 63 | + name: |
| 64 | + - ubuntu-latest |
| 65 | + include: |
| 66 | + - name: ubuntu-latest |
| 67 | + os: ubuntu-latest |
| 68 | + runs-on: ${{ matrix.os }} |
228 | 69 |
|
229 |
| - release: |
230 |
| - name: Release |
231 |
| - runs-on: ubuntu-latest |
232 |
| - if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} |
233 |
| - needs: [linux, musllinux, windows, macos, sdist] |
234 |
| - permissions: |
235 |
| - # Use to sign the release artifacts |
236 |
| - id-token: write |
237 |
| - # Used to upload release artifacts |
238 |
| - contents: write |
239 |
| - # Used to generate artifact attestation |
240 |
| - attestations: write |
241 | 70 | steps:
|
242 |
| - - uses: actions/download-artifact@v4 |
243 |
| - - name: Generate artifact attestation |
244 |
| - uses: actions/attest-build-provenance@v2 |
245 |
| - with: |
246 |
| - subject-path: 'wheels-*/*' |
247 |
| - - name: Publish to PyPI |
248 |
| - if: ${{ startsWith(github.ref, 'refs/tags/') }} |
249 |
| - uses: PyO3/maturin-action@v1 |
250 |
| - env: |
251 |
| - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 71 | + - name: Checkout Repository |
| 72 | + uses: actions/checkout@v4 |
| 73 | + |
| 74 | + - name: Install uv |
| 75 | + uses: astral-sh/setup-uv@v5 |
252 | 76 | with:
|
253 |
| - command: upload |
254 |
| - args: --non-interactive --skip-existing wheels-*/* |
| 77 | + version: "0.7.3" |
| 78 | + |
| 79 | + - name: Install Python |
| 80 | + run: uv python install |
| 81 | + |
| 82 | + - name: Install the project |
| 83 | + run: uv sync --group testing |
| 84 | + |
| 85 | + - name: Run tests |
| 86 | + run: uv run pytest tests |
0 commit comments