@@ -23,6 +23,7 @@ permissions:
2323
2424jobs :
2525 build :
26+ name : build (${{ matrix.name }})
2627 runs-on : ${{ matrix.os }}
2728 permissions :
2829 contents : read
3132
3233 strategy :
3334 matrix :
34- os : [ubuntu-latest, macos-latest, windows-latest]
35+ include :
36+ - name : ubuntu-latest
37+ dist_path : dist
38+ os : ubuntu-latest
39+ python : " 3.11"
40+ target : native
41+ - name : ubuntu-24.04-arm
42+ dist_path : dist
43+ os : ubuntu-24.04-arm
44+ python : " 3.11"
45+ target : native
46+ - name : macos-latest
47+ dist_path : dist
48+ os : macos-latest
49+ python : " 3.11"
50+ target : native
51+ - name : windows-latest
52+ dist_path : dist
53+ os : windows-latest
54+ python : " 3.11"
55+ target : native
56+
3557
3658 steps :
3759 - name : Checkout
4264 - name : Setup Python
4365 uses : actions-ext/python/setup@ec67f82b3bd863948308a41ecb9e70547cbb19c7
4466 with :
45- version : " 3.11 "
67+ version : ${{ matrix.python }}
4668
4769 - name : Setup Rust
4870 uses : actions-ext/rust/setup@0f0b7c9ab3cdb6e9a1f79e2147974d6762ddafea
@@ -57,54 +79,62 @@ jobs:
5779
5880 - name : Install dependencies
5981 run : make develop
82+ if : matrix.target == 'native'
6083
6184 - name : Lint
6285 run : make lint
86+ if : matrix.target == 'native'
6387
6488 - name : Checks
6589 run : make checks
66- if : matrix.os == 'ubuntu-latest'
90+ if : matrix.name == 'ubuntu-latest'
6791
6892 # On Linux `make dist-rs` rebuilds this same release profile, and
6993 # cibuildwheel then rebuilds the tree again from scratch in the manylinux
7094 # container, so building here is a third compile and a third copy on disk.
7195 - name : Build
7296 run : make build
73- if : matrix.os != 'ubuntu-latest '
97+ if : matrix.target == 'native' && runner. os != 'Linux '
7498
99+ # Coverage instrumentation forces a rebuild that shares nothing with the
100+ # cached ordinary build, so only the platform that uploads it pays for it.
75101 - name : Test
76102 run : make coverage
103+ if : matrix.name == 'ubuntu-latest'
104+
105+ - name : Test
106+ run : make test
107+ if : matrix.target == 'native' && matrix.name != 'ubuntu-latest'
108+
109+ - name : Build and test Pyodide wheel
110+ run : make test-pyodide
111+ if : matrix.target == 'pyodide'
77112
78113 - name : Upload test results (Python)
79114 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
80115 with :
81- name : test-results-${{ matrix.os }}
116+ name : test-results-${{ matrix.name }}
82117 path : ' **/junit.xml'
83- if : always()
118+ if : always() && matrix.target == 'native'
84119
85120 - name : Publish test results
86121 uses : EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3 # v2.24.0
87122 with :
88123 files : ' **/junit.xml'
89- if : matrix.os == 'ubuntu-latest'
124+ if : matrix.name == 'ubuntu-latest'
90125
91126 - name : Upload coverage
92127 uses : codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
93128 with :
94129 token : ${{ secrets.CODECOV_TOKEN }}
95-
96- - name : Set up QEMU
97- uses : docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
98- with :
99- platforms : all
100- if : runner.os == 'Linux' && runner.arch == 'X64'
130+ if : matrix.name == 'ubuntu-latest'
101131
102132 - name : Free disk space
103133 run : |
104134 sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/.ghcup /usr/share/swift
105135 df -h /
106136 shell : bash
107- if : matrix.os == 'ubuntu-latest '
137+ if : matrix.target == 'native' && runner. os == 'Linux '
108138
109139 # The wheel is compiled inside the manylinux container, which cannot see
110140 # the Swatinem/rust-cache the host steps use. pyproject points the
@@ -119,25 +149,40 @@ jobs:
119149 path : |
120150 /tmp/cibw-cargo-home
121151 /tmp/cibw-cargo-target
122- key : cibw-cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock', 'rust/Cargo.lock') }}
152+ key : cibw-cargo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Cargo.lock', 'rust/Cargo.lock') }}
123153 restore-keys : |
124- cibw-cargo-${{ runner.os }}-
125- if : matrix.os == 'ubuntu-latest '
154+ cibw-cargo-${{ runner.os }}-${{ runner.arch }}-
155+ if : matrix.target == 'native' && runner. os == 'Linux '
126156
127- - name : Build distributions (Linux)
157+ - name : Build distributions (Linux x86_64 )
128158 run : |
129159 rm -rf dist
130160 make dist-rs
131161 make dist-py-sdist
132- rm -rf rust/target
133162 make dist-py-wheel
134163 make dist-check
135164 # The container writes these as root; hand them back so the cache save
136165 # can read them.
137166 sudo chown -R "$(id -u):$(id -g)" /tmp/cibw-cargo-home /tmp/cibw-cargo-target
138167 du -sh /tmp/cibw-cargo-home /tmp/cibw-cargo-target
139168 shell : bash
140- if : matrix.os == 'ubuntu-latest'
169+ env :
170+ CIBW_ARCHS_LINUX : native
171+ if : matrix.name == 'ubuntu-latest'
172+
173+ - name : Build distributions (Linux ARM64)
174+ run : |
175+ rm -rf dist
176+ make dist-py-wheel
177+ make dist-check
178+ # The container writes these as root; hand them back so the cache save
179+ # can read them.
180+ sudo chown -R "$(id -u):$(id -g)" /tmp/cibw-cargo-home /tmp/cibw-cargo-target
181+ du -sh /tmp/cibw-cargo-home /tmp/cibw-cargo-target
182+ shell : bash
183+ env :
184+ CIBW_ARCHS_LINUX : native
185+ if : matrix.name == 'ubuntu-24.04-arm'
141186
142187 - name : Build distributions (macOS/Windows)
143188 run : |
@@ -147,22 +192,22 @@ jobs:
147192 shell : bash
148193 env :
149194 CIBW_ENVIRONMENT_MACOS : MACOSX_DEPLOYMENT_TARGET=11.0
150- if : matrix.os != 'ubuntu-latest '
195+ if : matrix.target == 'native' && runner. os != 'Linux '
151196
152197 - name : Test wheel
153198 uses : actions-ext/python/test-wheel@ec67f82b3bd863948308a41ecb9e70547cbb19c7
154199 with :
155200 module : nepenthe
156- if : matrix.os == 'ubuntu-latest '
201+ if : matrix.target == 'native' && runner. os == 'Linux '
157202
158203 - name : Test source distribution
159204 uses : actions-ext/python/test-sdist@ec67f82b3bd863948308a41ecb9e70547cbb19c7
160205 with :
161206 module : nepenthe
162- if : matrix.os == 'ubuntu-latest'
207+ if : matrix.name == 'ubuntu-latest'
163208
164209 - name : Upload distributions
165210 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
166211 with :
167- name : dist-${{ matrix.os }}
168- path : dist
212+ name : dist-${{ matrix.name }}
213+ path : ${{ matrix.dist_path }}
0 commit comments