51
51
~/.cargo/registry
52
52
~/.cargo/git
53
53
target
54
- # Rebuild whenever the cargo lock file changes
55
- key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
54
+ # Use the OS, the python version, and the hashed cargo lockfile as the
55
+ # cache key. The Python version shouldn't be necessary, but I have
56
+ # seen some weird failures in Windows CI where it gets the built
57
+ # python targets confused. The Python version is included at the
58
+ # end so it can be partially matched by cache keys in contexts
59
+ # where we're not iterating over python envs.
60
+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.python-version }}
56
61
57
62
# Cache `cargo install` built binaries
58
63
- name : " Cache Built Binaries"
89
94
run : |
90
95
cargo test --features=wasm
91
96
make develop-py-wheel
97
+ ls dist/*.whl
92
98
pip install dist/*.whl
99
+ echo "Running Tests"
93
100
python tests/test_py.py
94
101
env :
95
102
WINDOWS : " ${{ contains(runner.os, 'windows') }}"
@@ -139,7 +146,8 @@ jobs:
139
146
~/.cargo/registry
140
147
~/.cargo/git
141
148
target
142
- # Rebuild whenever the cargo lock file changes
149
+ # This should partial match the caches generated for the tests,
150
+ # which include a python version at the end.
143
151
key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
144
152
145
153
# Cache `cargo install` built binaries
@@ -188,13 +196,84 @@ jobs:
188
196
path : js/
189
197
name : wasm-pkg
190
198
191
- build-python-wheels :
192
- name : " Build Python Wheels"
199
+ build-python-wheels-linux :
200
+ # Linux wheels can't be built directly but instead need to be built
201
+ # via a "manylinux" container as specified by PEPs 513, 571, and 599
202
+ name : " Build Linux Wheels"
203
+ needs : " test"
204
+ if : " ${{ github.ref == 'master' }}"
205
+ runs-on : " ubuntu-latest"
206
+ strategy :
207
+ matrix :
208
+ manylinux :
209
+ - arch : " manylinux1_i686"
210
+ img : " quay.io/pypa/manylinux1_i686:2020-07-04-283458f"
211
+ - arch : " manylinux1_x86_64"
212
+ img : " quay.io/pypa/manylinux1_x86_64:2020-07-04-283458f"
213
+ - arch : " manylinux2010_i686"
214
+ img : " quay.io/pypa/manylinux2010_i686:2020-07-04-10a3c30"
215
+ - arch : " manylinux2010_x86_64"
216
+ img : " quay.io/pypa/manylinux2010_x86_64:2020-07-04-10a3c30"
217
+ - arch : " manylinux2014_i686"
218
+ img : " quay.io/pypa/manylinux2014_i686:2020-07-04-bb5f087"
219
+ - arch : " manylinux2014_x86_64"
220
+ img : " quay.io/pypa/manylinux2014_x86_64:2020-07-04-bb5f087"
221
+ steps :
222
+ # Check out the code
223
+ - uses : " actions/checkout@v2"
224
+ # Set the current month and year (used for cache key)
225
+ - name : " Get Date"
226
+ id : get-date
227
+ # Outputs e.g. "202007"
228
+ # tbh I have yet to find the docs where this output format is
229
+ # defined, but I copied this from the official cache action's README.
230
+ run : |
231
+ echo "::set-output name=date::$(/bin/date -u '+%Y%m')"
232
+ shell : bash
233
+
234
+ # Generate the lockfile
235
+ - name : " Generate Cargo Lockfile"
236
+ run : " cargo generate-lockfile"
237
+
238
+ # Cache build dependencies
239
+ - name : " Cache Build Fragments"
240
+ id : " cache-build-fragments"
241
+ uses : " actions/cache@v2"
242
+ with :
243
+ path : |
244
+ ~/.cargo/registry
245
+ ~/.cargo/git
246
+ target
247
+ # This should partial match the caches generated for the tests,
248
+ # which include a python version at the end.
249
+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
250
+
251
+ # Cache `cargo install` built binaries
252
+ - name : " Cache Built Binaries"
253
+ id : " cache-binaries"
254
+ uses : " actions/cache@v2"
255
+ with :
256
+ path : " ~/.cargo/bin"
257
+ # In theory, this should rebuild binaries once a month
258
+ key : " ${{ runner.os }}-cargo-binaries-${{steps.get-date.outputs.date}}"
259
+
260
+ - name : " Build Wheels"
261
+ run : " make build-py-wheel-manylinux"
262
+ env :
263
+ MANYLINUX_IMG : ${{ matrix.manylinux.img }}
264
+
265
+ - uses : " actions/upload-artifact@v2"
266
+ with :
267
+ path : " dist/*.whl"
268
+ name : " py-${{ matrix.manylinux.arch }}-wheels"
269
+
270
+ build-python-wheels-mac-windows :
271
+ name : " Build Python Wheels (MacOS, Windows)"
193
272
needs : test
194
273
if : " ${{ github.ref == 'master' }}"
195
274
strategy :
196
275
matrix :
197
- os : [ubuntu-latest, macos-latest, windows-latest]
276
+ os : [macos-latest, windows-latest]
198
277
python-version : [3.6, 3.7, 3.8]
199
278
runs-on : " ${{ matrix.os }}"
200
279
steps :
@@ -236,8 +315,13 @@ jobs:
236
315
~/.cargo/registry
237
316
~/.cargo/git
238
317
target
239
- # Rebuild whenever the cargo lock file changes
240
- key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
318
+ # Use the OS, the python version, and the hashed cargo lockfile as the
319
+ # cache key. The Python version shouldn't be necessary, but I have
320
+ # seen some weird failures in Windows CI where it gets the built
321
+ # python targets confused. The Python version is included at the
322
+ # end so it can be partially matched by cache keys in contexts
323
+ # where we're not iterating over python envs.
324
+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.python-version }}
241
325
242
326
# Cache `cargo install` built binaries
243
327
- name : " Cache Built Binaries"
@@ -264,4 +348,4 @@ jobs:
264
348
- uses : " actions/upload-artifact@v2"
265
349
with :
266
350
path : " dist/*.whl"
267
- name : " py-${{ matrix.python-version }}-${{ runner.os }}-whl "
351
+ name : " py-${{ matrix.python-version }}-${{ runner.os }}-wheels "
0 commit comments