-
Notifications
You must be signed in to change notification settings - Fork 39
800 lines (688 loc) · 24.6 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
name: CI
on:
# Every PR
pull_request:
# Once merged into `master`, and on `ci-full` to enable testing a full run
push:
branches:
- master
- ci-full
# Every monday at 09:00 in the morning
schedule:
- cron: '0 9 * * MON'
permissions:
contents: read
env:
# Disable incremental compilation
CARGO_BUILD_INCREMENTAL: false
# Set prettier + more verbose terminal output
CARGO_TERM_COLOR: always
CARGO_TERM_VERBOSE: true
RUST_BACKTRACE: 1
# Faster compilation, error on warnings and only document current crate
RUSTFLAGS: "--codegen=debuginfo=0 --deny=warnings"
RUSTDOCFLAGS: "--deny=warnings"
# Minimum deployment target
MACOSX_DEPLOYMENT_TARGET: 10.7
IPHONEOS_DEPLOYMENT_TARGET: 7.0
# We only support compiling Objective-C code with clang
CC: clang
CXX: clang++
# Crates that we want to run `rustdoc` and `clippy` on
#
# This excludes `header-translator`, `test-assembly`, `tests` and `test-ui`.
PUBLIC_CRATES: >-
--package=block-sys
--package=block2
--package=icrate
--package=objc-sys
--package=objc2
--package=objc2-encode
--package=objc2-proc-macros
# The current nightly Rust version that our CI uses
CURRENT_NIGHTLY: nightly-2023-08-27
# Various features that we'd usually want to test with
#
# Note: The `exception` feature is not enabled here, since it requires
# compiling C code, even if just running a `check`/`clippy` build.
INTERESTING_FEATURES: malloc,block,verify,unstable-private
UNSTABLE_FEATURES: unstable-autoreleasesafe,unstable-c-unwind
LATEST_MACOS_FEATURE: unstable-frameworks-macos-13
# Required when we want to use a different runtime than the default `apple`
OTHER_RUNTIME: --no-default-features --features=std
# https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
# Note: We don't cache `~/.cargo/bin`, that is done separately when needed.
CARGO_CACHE_PATH: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
# Only enable time-consuming checks when about to do a new release
#
# This condition is duplicated a few places, since there's no good way to
# deduplicate such information in GitHub Actions...
FULL: ${{ (github.head_ref == 'new-versions' || github.ref_name == 'ci-full') && true || '' }}
jobs:
fmt:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Use system Rust
run: cargo --version
- name: cargo fmt
# This runs on the entire repository, including submodules
run: cargo fmt -- --check
lint:
name: Lint ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
# These jobs are "cheap" to run, will likely run in parallel anyhow, and
# it can be useful to know exactly which parts failed.
fail-fast: false
matrix:
include:
- name: macOS 64bit
target: aarch64-apple-darwin
# Ideally this would use $LATEST_MACOS_FEATURE, but this causes clippy to
# use too much memory for the CI runner
args: >-
$PUBLIC_CRATES
--features=$INTERESTING_FEATURES
--features=unstable-frameworks-macos-12
- name: iOS 32bit
target: armv7-apple-ios
build-std: true
args: >-
-Zbuild-std
$PUBLIC_CRATES
--features=$INTERESTING_FEATURES
--features=unstable-frameworks-ios
- name: GNUStep + exceptions
target: x86_64-unknown-linux-gnu
args: >-
$PUBLIC_CRATES
$OTHER_RUNTIME --features=gnustep-1-9
--features=$INTERESTING_FEATURES,catch-all
--features=unstable-frameworks-gnustep
- name: header-translator
target: x86_64-unknown-linux-gnu
args: -pheader-translator
- name: test-assembly
target: x86_64-unknown-linux-gnu
args: -ptest-assembly
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.CURRENT_NIGHTLY }}
components: clippy ${{ matrix.build-std && ', rust-src' || '' }}
targets: ${{ (!matrix.build-std) && matrix.target || null }}
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: cargo doc
run: cargo doc --no-deps --document-private-items ${{ matrix.args }}
- name: cargo clippy
# Temporarily allow diverging_sub_expression until we figure out how to silence them in declare_class!
run: cargo clippy --all-targets ${{ matrix.args }} -- --allow=clippy::diverging_sub_expression
msrv:
name: Check MSRV
runs-on: ubuntu-latest
env:
CARGO_BUILD_TARGET: x86_64-apple-darwin
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: '1.60'
targets: x86_64-apple-darwin
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: cargo check
run: >-
cargo check
$PUBLIC_CRATES
--features=$INTERESTING_FEATURES
--features=$LATEST_MACOS_FEATURE
env:
RUSTFLAGS: "--codegen=debuginfo=0" # Removed --deny=warnings
ui:
name: Compiler UI
runs-on: macos-latest
needs:
- fmt
- lint
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.CURRENT_NIGHTLY }}
components: rust-src
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run UI tests
run: cargo run --features=run --bin=test-ui
assembly:
name: Assembly tests
runs-on: ubuntu-latest
needs:
- fmt
- lint
env:
TEST_OVERWRITE: 1
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.CURRENT_NIGHTLY }}
components: rust-src
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run macOS x86_64 assembly tests
run: cargo run --bin=test-assembly -- -Z build-std --target=x86_64-apple-darwin
- name: Run all assembly tests
if: ${{ env.FULL }}
run: ./helper-scripts/run-assembly-tests.sh
- name: Check diff
if: ${{ always() }}
run: git diff --exit-code
header-translator:
name: Verify header translator output
runs-on: macos-13
needs:
- fmt
- lint
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Use system Rust
run: cargo --version
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run header translator
run: cargo run --bin=header-translator
- name: Verify that no files changed
run: git diff --exit-code --submodule=diff
check-icrate-features:
# if: ${{ env.FULL }}
# This will take ~40 minutes
if: ${{ github.head_ref == 'new-versions' || github.ref_name == 'ci-full' }}
name: Check icrate features
runs-on: macos-12
needs:
- fmt
- lint
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Use system Rust
run: cargo --version
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Check `icrate` with each feature enabled separately
run: cargo run --bin=check_icrate_features
test-macos:
name: Test macOS 12
runs-on: macos-12
needs:
- fmt
# Currently the slowest check, so let's get it started as soon as possible
# - lint
env:
ARGS: --no-default-features --features=std,apple
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Test without features
run: cargo test $ARGS $PUBLIC_CRATES -ptests
- name: Test all frameworks
run: cargo test $ARGS $PUBLIC_CRATES -ptests --features=$INTERESTING_FEATURES,unstable-frameworks-macos-12
test-apple:
# if: ${{ env.FULL }}
if: ${{ github.head_ref == 'new-versions' || github.ref_name == 'ci-full' }}
name: ${{ matrix.name }}
runs-on: ${{ matrix.os || 'macos-latest' }}
needs:
- fmt
- lint
strategy:
# MacOS instances are rate-limited, which means that whenever we can
# avoid doing work, we should!
fail-fast: true
matrix:
include:
- name: Test macOS 11
os: macos-11
frameworks: macos-11
- name: Build macOS AArch64
target: aarch64-apple-darwin
frameworks: macos-11
- name: Test macOS old SDK
# Oldest macOS version we support
sdk: "10.7"
frameworks: macos-10-7
- name: Test macOS nightly
nightly: true
frameworks: macos-11
- name: Build macOS 32bit
target: i686-apple-darwin
nightly: true
build-std: true
# Newest SDK that supports 32-bit
sdk: "10.13"
frameworks: macos-10-13
- name: Build iOS simulator ARM64
target: aarch64-apple-ios-sim
frameworks: ios
- name: Build iOS ARM64
target: aarch64-apple-ios
frameworks: ios
- name: Build iOS ARMv7
target: armv7-apple-ios
nightly: true
build-std: true
frameworks: ios
- name: Build iOS ARMv7s
target: armv7s-apple-ios
nightly: true
build-std: true
frameworks: ios
- name: Build iOS 32bit x86
target: i386-apple-ios
nightly: true
build-std: true
frameworks: ios
env:
CARGO_BUILD_TARGET: ${{ matrix.target || 'x86_64-apple-darwin' }}
# Modern macOS can only run the target that they're built for.
# So we pass `--no-run` when building for other targets.
ARGS: >-
--no-default-features --features=std,apple
${{ matrix.build-std && '-Zbuild-std -Zdoctest-xcompile' }}
${{ matrix.target && '--no-run' }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.nightly && env.CURRENT_NIGHTLY || 'stable' }}
components: ${{ matrix.build-std && 'rust-src' }}
target: ${{ (!matrix.build-std) && matrix.target || null }}
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Cache SDK
id: sdk-cache
if: matrix.sdk
uses: actions/cache@v3
with:
path: ~/sdk
key: sdk-test-apple-${{ matrix.name }}
- name: Download different macOS SDK
if: matrix.sdk && steps.sdk-cache.outputs.cache-hit != 'true'
# macOS SDKs:
# - https://github.com/alexey-lysiuk/macos-sdk
# - https://github.com/phracker/MacOSX-SDKs
# - https://github.com/hexops/sdk-macos-12.0
#
# iOS SDKs:
# - https://github.com/xybp888/iOS-SDKs
# - https://github.com/theos/sdks
run: |
wget https://github.com/alexey-lysiuk/macos-sdk/releases/download/${{ matrix.sdk }}/MacOSX${{ matrix.sdk }}.tar.bz2
tar -xyf MacOSX${{ matrix.sdk }}.tar.bz2
mv MacOSX${{ matrix.sdk }}.sdk $HOME/sdk
- name: Setup SDK environment
if: matrix.sdk
# This changes a variable, so is only set when a custom SDK is used
run: echo "SDKROOT=$HOME/sdk" >> $GITHUB_ENV
- name: Test without features
run: cargo test $ARGS $PUBLIC_CRATES -ptests
- name: Test Foundation
run: >-
cargo test $ARGS $PUBLIC_CRATES -ptests
--features=$INTERESTING_FEATURES,Foundation_all
- name: Test all frameworks
run: >-
cargo test $ARGS $PUBLIC_CRATES -ptests
--features=$INTERESTING_FEATURES,catch-all,unstable-frameworks-${{ matrix.frameworks }}
- name: Test in release mode
run: >-
cargo test $ARGS $PUBLIC_CRATES -ptests
--features=$INTERESTING_FEATURES,catch-all,Foundation_all --release
- name: Test with unstable features
if: ${{ matrix.nightly }}
run: >-
cargo test $ARGS $PUBLIC_CRATES -ptests
--features=$INTERESTING_FEATURES,catch-all,Foundation_all,$UNSTABLE_FEATURES
# TODO: Re-enable this on all of Foundation once we do some form of
# availability checking.
- name: Test static class and selectors
if: ${{ !contains(matrix.frameworks, 'ios') && !contains(matrix.frameworks, 'macos-10-7') }}
run: >-
cargo test $ARGS $PUBLIC_CRATES -ptests
--features=unstable-static-sel,unstable-static-class,unstable-static-nsstring
--features=Foundation,Foundation_NSString
test-ios:
# if: ${{ env.FULL }}
if: ${{ github.head_ref == 'new-versions' || github.ref_name == 'ci-full' }}
name: Test on iOS simulator w. dinghy
runs-on: macos-11
needs:
- fmt
- lint
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: x86_64-apple-ios
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-dinghy
uses: taiki-e/install-action@v2
with:
tool: cargo-dinghy@0.6
- name: Launch XCode Simulator and prepare Dinghy
# Note that we're not testing all configurations with dinghy, since that
# takes a very long time to run, and hence impedes general development.
run: |
# Get system info
xcrun simctl list runtimes
# Launch the simulator
RUNTIME_ID=$(xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1)
SIM_ID=$(xcrun simctl create My-iphone7 com.apple.CoreSimulator.SimDeviceType.iPhone-7 $RUNTIME_ID)
xcrun simctl boot $SIM_ID
# Export simulator ID
echo "SIM_ID=$SIM_ID" >> $GITHUB_ENV
- name: Test
run: >-
cargo-dinghy --device=$SIM_ID test
$PUBLIC_CRATES -ptests
--features=$INTERESTING_FEATURES,catch-all
--features=unstable-frameworks-ios
test-gnustep:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
needs:
- fmt
- lint
strategy:
matrix:
include:
- name: Test GNUStep with libobjc2 v1.9
target: x86_64-unknown-linux-gnu
runtime: gnustep-1-9
libobjc2: "1.9"
frameworks: gnustep
- name: Test GNUStep with libobjc2 v2.0
# Fails for some reason on Ubuntu 22
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
runtime: gnustep-2-0
libobjc2: "2.0"
frameworks: gnustep
- name: Test GNUStep with libobjc2 v2.1 on nightly
target: x86_64-unknown-linux-gnu
nightly: true
runtime: gnustep-2-1
libobjc2: "2.1"
fuzz: true
frameworks: gnustep
- name: Test GNUStep 32bit
# Ubuntu 22 image doesn't have the required C++ libraries
# installed for 32-bit
os: ubuntu-20.04
target: i686-unknown-linux-gnu
cflags: -m32
configureflags: --target=x86-pc-linux-gnu
runtime: gnustep-1-9
libobjc2: "1.9"
frameworks: gnustep-32bit
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cflags }}
ASMFLAGS: ${{ matrix.cflags }}
LDFLAGS: ${{ matrix.cflags }}
ARGS: --no-default-features --features=std,${{ matrix.runtime }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache external dependencies
id: extern-cache
uses: actions/cache@v3
with:
# We could have just cached build-files, and then rerun the build tool
# every time, letting it figure out what's changed. However, this has
# the problem that GNUStep-Base ./configure invalidates the cache,
# which makes it very hard to know when to rebuild and when not to.
#
# So instead we just place the final outputs in ~/extern, and cache
# them there:
# - bin/*
# - lib/libobjc.so
# - lib/libgnustep-base.so
# - include/Foundation/*
# - include/objc/*
path: |
~/extern/bin
~/extern/lib
~/extern/include
# Change this key if we start caching more things
key: extern-${{ github.job }}-${{ matrix.name }}-v1
- name: Setup environment
# These add to PATH-like variables, so they can always be set
run: |
mkdir -p $HOME/extern/bin
mkdir -p $HOME/extern/lib
mkdir -p $HOME/extern/include
echo "PATH=$HOME/extern/bin:$PATH" >> $GITHUB_ENV
echo "LIBRARY_PATH=$HOME/extern/lib:$LIBRARY_PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$HOME/extern/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "CPATH=$HOME/extern/include:$CPATH" >> $GITHUB_ENV
# Debug print these
ls -al $HOME/extern/*
- name: Install Clang + Valgrind
run: |
sudo apt-get update
sudo apt-get -y install clang valgrind
- name: Install cross compilation tools
if: matrix.target == 'i686-unknown-linux-gnu'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install gcc-multilib libgcc-10-dev:i386 \
libc6-dev:i386 libstdc++-10-dev:i386 libffi-dev:i386 \
libxml2-dev:i386 libicu-dev:i386
- name: Install Make and Cmake
if: steps.extern-cache.outputs.cache-hit != 'true'
run: sudo apt-get -y install make cmake
- name: Install GNUStep libobjc2
if: steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/gnustep/libobjc2/archive/refs/tags/v${{ matrix.libobjc2 }}.tar.gz
tar -xzf v${{ matrix.libobjc2 }}.tar.gz
# Install robin-map on v2.1
if test -d libobjc2-2.1; then
cd libobjc2-2.1/third_party
# Remove possibly existing `robin-map` folder
rm -rf robin-map
wget https://github.com/Tessil/robin-map/archive/757de829927489bee55ab02147484850c687b620.tar.gz
tar -xzf 757de829927489bee55ab02147484850c687b620.tar.gz
mv robin-map-757de829927489bee55ab02147484850c687b620 robin-map
cd ../..
fi
mkdir -p libobjc2-${{ matrix.libobjc2 }}/build
cd libobjc2-${{ matrix.libobjc2 }}/build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=$HOME/extern -DTESTS=OFF ..
make install
- name: Install GNUStep make
if: steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/gnustep/tools-make/archive/refs/tags/make-2_9_0.tar.gz
tar -xzf make-2_9_0.tar.gz
mkdir -p tools-make-make-2_9_0/build
cd tools-make-make-2_9_0/build
../configure --prefix=$HOME/extern --with-library-combo=ng-gnu-gnu
make install
- name: Install GNUStep base library
if: steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/gnustep/libs-base/archive/refs/tags/base-1_28_0.tar.gz
tar -xzf base-1_28_0.tar.gz
cd libs-base-base-1_28_0
./configure --prefix=$HOME/extern --disable-tls --disable-xslt ${{ matrix.configureflags }}
make install
ls -al $HOME/extern/*
- name: Install GNUStep GUI
if: matrix.target == 'x86_64-unknown-linux-gnu' && steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/gnustep/libs-gui/archive/refs/tags/gui-0_29_0.tar.gz
tar -xzf gui-0_29_0.tar.gz
cd libs-gui-gui-0_29_0
./configure --prefix=$HOME/extern --disable-jpeg ${{ matrix.configureflags }}
make install
ls -al $HOME/extern/*
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.nightly && env.CURRENT_NIGHTLY || 'stable' }}
targets: ${{ matrix.target }}
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo-fuzz
if: ${{ matrix.fuzz }}
id: fuzz-cache
uses: actions/cache@v3
with:
path: ~/.cargo/bin/cargo-fuzz
# Change this key if we update the required cargo-fuzz version
key: cargo-fuzz-${{ github.job }}-${{ matrix.name }}-v0-11-2
- name: Install cargo-fuzz
if: ${{ matrix.fuzz && steps.fuzz-cache.outputs.cache-hit != 'true' }}
run: cargo install cargo-fuzz --version=^0.11.2
- name: Test Foundation
run: cargo test $ARGS --features=$INTERESTING_FEATURES,catch-all,Foundation_all
- name: Test all frameworks
if: ${{ env.FULL }}
run: cargo test $ARGS --features=$INTERESTING_FEATURES,catch-all,unstable-frameworks-${{ matrix.frameworks }}
- name: Test in release mode
# Disabled on GNUStep 2.1 for now
if: ${{ env.FULL && matrix.runtime != 'gnustep-2-1' }}
run: cargo test $ARGS --features=Foundation_all --release
- name: Run fuzzing
if: ${{ matrix.fuzz }}
run: |
# Run each fuzz target for 100000 runs (approx. 5 seconds), and
# timeout after 2 seconds.
#
# We specify the number of runs explicitly instead of using
# `max_total_time`, to get more determinism.
for fuzz_target in $(cargo-fuzz list --fuzz-dir=./crates/test-fuzz/)
do
cargo-fuzz run --fuzz-dir=./crates/test-fuzz/ $fuzz_target $ARGS,fuzz-all -- -runs=10000 -timeout=2 -jobs=10
done
# Check if the fuzzer encountered something that should be added to
# the corpus.
git diff --exit-code
- name: Run benchmarks
# Disabled since it started failing for some reason
if: ${{ false }}
# Difficult to install Valgrind on macOS
# See https://github.com/LouisBrunner/valgrind-macos
run: cargo bench $ARGS
- name: Test with unstable features
if: ${{ env.FULL && matrix.nightly }}
run: cargo test $ARGS --features=$INTERESTING_FEATURES,catch-all,Foundation_all,$UNSTABLE_FEATURES
test-compiler-rt:
name: Test Compiler-RT
runs-on: ubuntu-latest
needs:
- fmt
- lint
env:
# `compiler-rt` is only relevant for these crates
PUBLIC_CRATES: >-
--package=block-sys
--package=block2
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Use system Rust
run: cargo --version
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install clang + libBlocksRuntime
run: |
sudo apt-get update
sudo apt-get -y install clang libblocksruntime-dev
- name: Test
run: cargo test $PUBLIC_CRATES $OTHER_RUNTIME --features=compiler-rt
- name: Test in release mode
run: cargo test $PUBLIC_CRATES $OTHER_RUNTIME --features=compiler-rt --release