Skip to content

Commit 36d6275

Browse files
authored
Merge pull request #228 from madsmtm/ci-dinghy
Update `cargo-dinghy` to v0.6.0
2 parents 4896bed + de8456a commit 36d6275

File tree

2 files changed

+47
-91
lines changed

2 files changed

+47
-91
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v2
2929
- name: Check formatting
30-
uses: actions-rs/cargo@v1
31-
with:
32-
command: fmt
33-
args: -- --check
30+
run: cargo fmt -- --check
3431

3532
test:
3633
name: ${{ matrix.name }}
@@ -157,6 +154,7 @@ jobs:
157154
SOME_FEATURES: ${{ matrix.features || 'malloc,block,exception,foundation' }}
158155
FEATURES: ${{ matrix.features || 'malloc,block,exception,foundation,catch-all,verify_message,uuid' }}
159156
UNSTABLE_FEATURES: ${{ matrix.unstable-features || 'unstable-autoreleasesafe,unstable-c-unwind' }}
157+
CMD: cargo
160158

161159
runs-on: ${{ matrix.os }}
162160

@@ -190,7 +188,7 @@ jobs:
190188
~/extern/include
191189
~/extern/sdk
192190
# Change this key if we start caching more things
193-
key: ${{ matrix.name }}-extern-v2
191+
key: ${{ matrix.name }}-extern-v3
194192

195193
- name: Setup environment
196194
# These add to PATH-like variables, so they can always be set
@@ -293,14 +291,22 @@ jobs:
293291
make install
294292
ls -al $HOME/extern/*
295293
296-
- name: Cache Rust
294+
- name: Cache Cargo
297295
uses: actions/cache@v2
298296
with:
299297
path: |
300-
~/.cargo/
301-
target/
298+
~/.cargo/bin/
299+
~/.cargo/registry/index/
300+
~/.cargo/registry/cache/
301+
~/.cargo/git/db/
302302
key: cargo-${{ matrix.name }}-${{ hashFiles('**/Cargo.toml') }}
303303

304+
- name: Cache Rust Target
305+
uses: actions/cache@v2
306+
with:
307+
path: target/
308+
key: rust-${{ matrix.name }}-${{ hashFiles('**/Cargo.toml') }}
309+
304310
- name: Install Rust toolchain
305311
uses: actions-rs/toolchain@v1
306312
with:
@@ -313,72 +319,56 @@ jobs:
313319

314320
- name: Install Cargo Dinghy
315321
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
319339
320340
- 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
326343

327344
- 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 }}
333346

334347
- 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
340349

341350
- name: Test without features
342351
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 }}
347353

348354
- name: Test with some features
349355
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 }}
354357

355358
- 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 }}
361360

362361
- name: Test in release mode without features
363362
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
368364

369365
- name: Test in release mode with features
370366
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
375368

376369
- name: Run UI tests
377370
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
382372
env:
383373
# Allow warnings
384374
RUSTFLAGS: "-C debuginfo=0"
@@ -387,25 +377,16 @@ jobs:
387377
# Difficult to install Valgrind on macOS
388378
# See https://github.com/LouisBrunner/valgrind-macos
389379
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 }}
394381

395382
- name: Test with unstable features
396383
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 }}
402386

403387
- name: Test static class and selectors
404388
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
409390

410391
- name: Run assembly tests
411392
if: ${{ !contains(matrix.runtime, 'compiler-rt') }}
@@ -414,25 +395,3 @@ jobs:
414395
export HOST_TARGET=$(rustc -vV | grep host | cut -f2 -d' ')
415396

416397
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 }}

objc2/src/declare.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,8 @@ mod tests {
566566
let superclass = test_utils::custom_class();
567567
let builder = ClassBuilder::new("TestFetchWhileCreatingClass", superclass).unwrap();
568568

569-
if cfg!(all(
570-
feature = "apple",
571-
not(all(target_os = "macos", target_arch = "x86"))
572-
)) {
573-
// It is IMO a bug in Apple's new runtime that it is present here
569+
if cfg!(all(feature = "apple", target_arch = "x86_64")) {
570+
// It is IMO a bug that it is present here!
574571
assert!(is_present(builder.cls.as_ptr()));
575572
} else {
576573
assert!(!is_present(builder.cls.as_ptr()));

0 commit comments

Comments
 (0)