27
27
steps :
28
28
- uses : actions/checkout@v2
29
29
- name : Check formatting
30
- uses : actions-rs/cargo@v1
31
- with :
32
- command : fmt
33
- args : -- --check
30
+ run : cargo fmt -- --check
34
31
35
32
test :
36
33
name : ${{ matrix.name }}
@@ -157,6 +154,7 @@ jobs:
157
154
SOME_FEATURES : ${{ matrix.features || 'malloc,block,exception,foundation' }}
158
155
FEATURES : ${{ matrix.features || 'malloc,block,exception,foundation,catch-all,verify_message,uuid' }}
159
156
UNSTABLE_FEATURES : ${{ matrix.unstable-features || 'unstable-autoreleasesafe,unstable-c-unwind' }}
157
+ CMD : cargo
160
158
161
159
runs-on : ${{ matrix.os }}
162
160
@@ -190,7 +188,7 @@ jobs:
190
188
~/extern/include
191
189
~/extern/sdk
192
190
# Change this key if we start caching more things
193
- key : ${{ matrix.name }}-extern-v2
191
+ key : ${{ matrix.name }}-extern-v3
194
192
195
193
- name : Setup environment
196
194
# These add to PATH-like variables, so they can always be set
@@ -293,14 +291,22 @@ jobs:
293
291
make install
294
292
ls -al $HOME/extern/*
295
293
296
- - name : Cache Rust
294
+ - name : Cache Cargo
297
295
uses : actions/cache@v2
298
296
with :
299
297
path : |
300
- ~/.cargo/
301
- target/
298
+ ~/.cargo/bin/
299
+ ~/.cargo/registry/index/
300
+ ~/.cargo/registry/cache/
301
+ ~/.cargo/git/db/
302
302
key : cargo-${{ matrix.name }}-${{ hashFiles('**/Cargo.toml') }}
303
303
304
+ - name : Cache Rust Target
305
+ uses : actions/cache@v2
306
+ with :
307
+ path : target/
308
+ key : rust-${{ matrix.name }}-${{ hashFiles('**/Cargo.toml') }}
309
+
304
310
- name : Install Rust toolchain
305
311
uses : actions-rs/toolchain@v1
306
312
with :
@@ -313,72 +319,56 @@ jobs:
313
319
314
320
- name : Install Cargo Dinghy
315
321
if : matrix.dinghy && steps.extern-cache.outputs.cache-hit != 'true'
316
- # TODO: Replace once cargo dinghy gets updated
317
- # cargo install cargo-dinghy --version=^0.4 --root=$HOME/extern --target=x86_64-apple-darwin
318
- run : cargo install --git https://github.com/madsmtm/dinghy.git --branch update-cargo --bin cargo-dinghy --root=$HOME/extern --target=x86_64-apple-darwin
322
+ run : cargo install cargo-dinghy --version=^0.6.0 --root=$HOME/extern --target=x86_64-apple-darwin
323
+
324
+ - name : Launch XCode Simulator and prepare Dinghy
325
+ if : matrix.dinghy
326
+ # Note that we're not testing all configurations with dinghy, since that
327
+ # takes a very long time to run, and hence impedes general development.
328
+ run : |
329
+ # Get system info
330
+ xcrun simctl list runtimes
331
+
332
+ # Launch the simulator
333
+ RUNTIME_ID=$(xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1)
334
+ SIM_ID=$(xcrun simctl create My-iphone7 com.apple.CoreSimulator.SimDeviceType.iPhone-7 $RUNTIME_ID)
335
+ xcrun simctl boot $SIM_ID
336
+
337
+ # Export variable
338
+ echo "CMD=$HOME/extern/bin/cargo-dinghy -d=$SIM_ID" >> $GITHUB_ENV
319
339
320
340
- name : Lint
321
- uses : actions-rs/cargo@v1
322
- with :
323
- command : clippy
324
- # Temporarily allow `clippy::let_unit_value`
325
- args : ${{ env.ARGS }} --all-targets -- --deny warnings --allow clippy::let_unit_value
341
+ # Temporarily allow `clippy::let_unit_value`
342
+ run : cargo clippy ${{ env.ARGS }} --all-targets -- --deny warnings --allow clippy::let_unit_value
326
343
327
344
- name : Build
328
- if : ${{ !matrix.dinghy }}
329
- uses : actions-rs/cargo@v1
330
- with :
331
- command : build
332
- args : ${{ env.ARGS }}
345
+ run : $CMD build ${{ env.ARGS }}
333
346
334
347
- name : Check documentation
335
- if : ${{ !matrix.dinghy }}
336
- uses : actions-rs/cargo@v1
337
- with :
338
- command : doc
339
- args : ${{ env.ARGS }} --no-deps --document-private-items
348
+ run : $CMD doc ${{ env.ARGS }} --no-deps --document-private-items
340
349
341
350
- name : Test without features
342
351
if : ${{ !matrix.dinghy }}
343
- uses : actions-rs/cargo@v1
344
- with :
345
- command : test
346
- args : ${{ env.ARGS }} ${{ env.TESTARGS }}
352
+ run : cargo test ${{ env.ARGS }} ${{ env.TESTARGS }}
347
353
348
354
- name : Test with some features
349
355
if : ${{ !matrix.dinghy }}
350
- uses : actions-rs/cargo@v1
351
- with :
352
- command : test
353
- args : ${{ env.ARGS }} ${{ env.TESTARGS }} --tests --features ${{ env.SOME_FEATURES }}
356
+ run : cargo test ${{ env.ARGS }} ${{ env.TESTARGS }} --tests --features ${{ env.SOME_FEATURES }}
354
357
355
358
- name : Test with features
356
- if : ${{ !matrix.dinghy }}
357
- uses : actions-rs/cargo@v1
358
- with :
359
- command : test
360
- args : ${{ env.ARGS }} ${{ env.TESTARGS }} --features ${{ env.FEATURES }}
359
+ run : $CMD test ${{ env.ARGS }} ${{ env.TESTARGS }} --features ${{ env.FEATURES }}
361
360
362
361
- name : Test in release mode without features
363
362
if : ${{ !matrix.dinghy }}
364
- uses : actions-rs/cargo@v1
365
- with :
366
- command : test
367
- args : ${{ env.ARGS }} ${{ env.TESTARGS }} --release
363
+ run : cargo test ${{ env.ARGS }} ${{ env.TESTARGS }} --release
368
364
369
365
- name : Test in release mode with features
370
366
if : ${{ !matrix.dinghy }}
371
- uses : actions-rs/cargo@v1
372
- with :
373
- command : test
374
- args : ${{ env.ARGS }} ${{ env.TESTARGS }} --features ${{ env.FEATURES }} --release
367
+ run : cargo test ${{ env.ARGS }} ${{ env.TESTARGS }} --features ${{ env.FEATURES }} --release
375
368
376
369
- name : Run UI tests
377
370
if : ${{ matrix.ui }}
378
- uses : actions-rs/cargo@v1
379
- with :
380
- command : run
381
- args : --features=run --bin test-ui
371
+ run : cargo run --features=run --bin test-ui
382
372
env :
383
373
# Allow warnings
384
374
RUSTFLAGS : " -C debuginfo=0"
@@ -387,25 +377,16 @@ jobs:
387
377
# Difficult to install Valgrind on macOS
388
378
# See https://github.com/LouisBrunner/valgrind-macos
389
379
if : contains(matrix.os, 'ubuntu')
390
- uses : actions-rs/cargo@v1
391
- with :
392
- command : bench
393
- args : ${{ env.ARGS }} ${{ env.TESTARGS }}
380
+ run : cargo bench ${{ env.ARGS }} ${{ env.TESTARGS }}
394
381
395
382
- name : Test with unstable features
396
383
if : ${{ !matrix.dinghy && matrix.rust.toolchain == 'nightly' }}
397
- uses : actions-rs/cargo@v1
398
- with :
399
- command : test
400
- # Not using --all-features because that would enable e.g. gnustep
401
- args : ${{ env.ARGS }} ${{ env.TESTARGS }} --features ${{ env.FEATURES }},${{ env.UNSTABLE_FEATURES }}
384
+ # Not using --all-features because that would enable e.g. gnustep
385
+ run : cargo test ${{ env.ARGS }} ${{ env.TESTARGS }} --features ${{ env.FEATURES }},${{ env.UNSTABLE_FEATURES }}
402
386
403
387
- name : Test static class and selectors
404
388
if : ${{ !matrix.dinghy && (matrix.runtime || 'apple') == 'apple' }}
405
- uses : actions-rs/cargo@v1
406
- with :
407
- command : test
408
- args : ${{ env.ARGS }} ${{ env.TESTARGS }} --features foundation,unstable-static-sel,unstable-static-class
389
+ run : cargo test ${{ env.ARGS }} ${{ env.TESTARGS }} --features foundation,unstable-static-sel,unstable-static-class
409
390
410
391
- name : Run assembly tests
411
392
if : ${{ !contains(matrix.runtime, 'compiler-rt') }}
@@ -414,25 +395,3 @@ jobs:
414
395
export HOST_TARGET=$(rustc -vV | grep host | cut -f2 -d' ')
415
396
416
397
cargo run --target=$HOST_TARGET --features=run --bin test-assembly -- ${{ env.ARGS }}
417
-
418
- - name : Launch XCode Simulator
419
- if : matrix.dinghy
420
- run : |
421
- # Get system info
422
- xcrun simctl list runtimes
423
-
424
- # Launch the simulator
425
- RUNTIME_ID=$(xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1)
426
- export SIM_ID=$(xcrun simctl create My-iphone7 com.apple.CoreSimulator.SimDeviceType.iPhone-7 $RUNTIME_ID)
427
- xcrun simctl boot $SIM_ID
428
-
429
- - name : Build w. Cargo Dinghy
430
- if : matrix.dinghy
431
- run : cargo dinghy --device=$SIM_ID build ${{ matrix.args }}
432
-
433
- - name : Test w. Cargo Dinghy
434
- if : matrix.dinghy
435
- # Note that we're not testing more complex configurations, since that
436
- # takes a very long time to run in CI, and that impedes general
437
- # development work.
438
- run : cargo dinghy --device=$SIM_ID test ${{ matrix.args }}
0 commit comments