Skip to content

Commit e1deb93

Browse files
committed
Update CI
1 parent f2a98ab commit e1deb93

File tree

8 files changed

+89
-41
lines changed

8 files changed

+89
-41
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,6 @@ jobs:
191191
matrix:
192192
os:
193193
- ubuntu-latest
194-
# - macos-latest
195-
# - windows-latest
196194
runs-on: ${{ matrix.os }}
197195
steps:
198196
- uses: actions/checkout@v3
@@ -214,10 +212,6 @@ jobs:
214212
run: cargo install cargo-hack
215213
- name: ASAN / LSAN / TSAN (Linux)
216214
run: ci/sanitizer.sh
217-
if: matrix.os == 'ubuntu-latest'
218-
- name: ASAN / LSAN / TSAN
219-
run: ci/sanitizer_generic.sh
220-
if: matrix.os != 'ubuntu-latest'
221215

222216
miri-tb:
223217
name: miri-tb
@@ -227,6 +221,12 @@ jobs:
227221
- ubuntu-latest
228222
- macos-latest
229223
- windows-latest
224+
target:
225+
- x86_64-unknown-linux-gnu
226+
- i686-unknown-linux-gnu
227+
- powerpc64-unknown-linux-gnu
228+
cfg:
229+
- all_tests
230230
runs-on: ${{ matrix.os }}
231231
steps:
232232
- uses: actions/checkout@v3
@@ -243,11 +243,13 @@ jobs:
243243
- name: Install cargo-hack
244244
run: cargo install cargo-hack
245245
- name: Miri (Linux)
246-
run: ci/miri_tb.sh
246+
run: |
247+
bash ci/miri_tb.sh ${{ matrix.target }} ${{ matrix.cfg }}
247248
if: matrix.os == 'ubuntu-latest'
248-
- name: Miri
249-
run: ci/miri_tb_generic.sh
250-
if: matrix.os != 'ubuntu-latest'
249+
- name: Miri (macOS)
250+
run: |
251+
bash ci/miri_tb_generic.sh ${{ matrix.cfg }}
252+
if: matrix.os == 'macos-latest'
251253

252254
miri-sb:
253255
name: miri-sb
@@ -257,6 +259,12 @@ jobs:
257259
- ubuntu-latest
258260
- macos-latest
259261
- windows-latest
262+
target:
263+
- x86_64-unknown-linux-gnu
264+
- i686-unknown-linux-gnu
265+
- powerpc64-unknown-linux-gnu
266+
cfg:
267+
- all_tests
260268
runs-on: ${{ matrix.os }}
261269
steps:
262270
- uses: actions/checkout@v3
@@ -273,11 +281,13 @@ jobs:
273281
- name: Install cargo-hack
274282
run: cargo install cargo-hack
275283
- name: Miri (Linux)
276-
run: ci/miri_sb.sh
284+
run: |
285+
bash ci/miri_sb.sh ${{ matrix.target }} ${{ matrix.cfg }}
277286
if: matrix.os == 'ubuntu-latest'
278-
- name: Miri
279-
run: ci/miri_sb_generic.sh
280-
if: matrix.os != 'ubuntu-latest'
287+
- name: Miri (macOS)
288+
run: |
289+
bash ci/miri_sb_generic.sh ${{ matrix.cfg }}
290+
if: matrix.os == 'macos-latest'
281291

282292
loom:
283293
name: loom

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,10 @@ rpath = false
3838
[package.metadata.docs.rs]
3939
all-features = true
4040
rustdoc-args = ["--cfg", "docsrs"]
41+
42+
[lints.rust]
43+
rust_2018_idioms = "warn"
44+
single_use_lifetimes = "warn"
45+
unexpected_cfgs = { level = "warn", check-cfg = [
46+
'cfg(all_tests)',
47+
] }

ci/miri_sb.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
#!/bin/bash
22
set -e
33

4+
# Check if TARGET and CONFIG_FLAGS are provided, otherwise panic
5+
if [ -z "$1" ]; then
6+
echo "Error: TARGET is not provided"
7+
exit 1
8+
fi
9+
10+
if [ -z "$2" ]; then
11+
echo "Error: CONFIG_FLAGS are not provided"
12+
exit 1
13+
fi
14+
15+
TARGET=$1
16+
CONFIG_FLAGS=$2
17+
418
rustup toolchain install nightly --component miri
519
rustup override set nightly
620
cargo miri setup
721

822
export MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-disable-isolation -Zmiri-symbolic-alignment-check"
23+
export RUSTFLAGS="--cfg test_$CONFIG_FLAGS"
924

10-
cargo miri test --tests --target x86_64-unknown-linux-gnu --all-features
11-
# cargo miri test --tests --target aarch64-unknown-linux-gnu #crossbeam_utils has problem on this platform
12-
cargo miri test --tests --target i686-unknown-linux-gnu --all-features
13-
cargo miri test --tests --target powerpc64-unknown-linux-gnu --all-features
25+
cargo miri test --tests --target $TARGET --lib

ci/miri_sb_generic.sh

100755100644
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
#!/bin/bash
22
set -e
33

4+
if [ -z "$1" ]; then
5+
echo "Error: CONFIG_FLAGS are not provided"
6+
exit 1
7+
fi
8+
9+
CONFIG_FLAGS=$1
10+
411
rustup toolchain install nightly --component miri
512
rustup override set nightly
613
cargo miri setup
714

815
export MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-disable-isolation -Zmiri-symbolic-alignment-check"
16+
export RUSTFLAGS="--cfg test_$CONFIG_FLAGS"
917

10-
cargo miri test --tests --all-features
18+
cargo miri test --tests --lib

ci/miri_tb.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
#!/bin/bash
22
set -e
33

4+
# Check if TARGET and CONFIG_FLAGS are provided, otherwise panic
5+
if [ -z "$1" ]; then
6+
echo "Error: TARGET is not provided"
7+
exit 1
8+
fi
9+
10+
if [ -z "$2" ]; then
11+
echo "Error: CONFIG_FLAGS are not provided"
12+
exit 1
13+
fi
14+
15+
TARGET=$1
16+
CONFIG_FLAGS=$2
17+
418
rustup toolchain install nightly --component miri
519
rustup override set nightly
620
cargo miri setup
721

822
export MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-disable-isolation -Zmiri-symbolic-alignment-check -Zmiri-tree-borrows"
23+
export RUSTFLAGS="--cfg test_$CONFIG_FLAGS"
24+
25+
cargo miri test --tests --target $TARGET --lib
926

10-
cargo miri test --tests --target x86_64-unknown-linux-gnu --all-features
11-
# cargo miri test --tests --target aarch64-unknown-linux-gnu #crossbeam_utils has problem on this platform
12-
cargo miri test --tests --target i686-unknown-linux-gnu --all-features
13-
cargo miri test --tests --target powerpc64-unknown-linux-gnu --all-features

ci/miri_tb_generic.sh

100755100644
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
#!/bin/bash
22
set -e
33

4+
if [ -z "$1" ]; then
5+
echo "Error: CONFIG_FLAGS are not provided"
6+
exit 1
7+
fi
8+
9+
CONFIG_FLAGS=$1
10+
411
rustup toolchain install nightly --component miri
512
rustup override set nightly
613
cargo miri setup
714

815
export MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-disable-isolation -Zmiri-symbolic-alignment-check -Zmiri-tree-borrows"
16+
export RUSTFLAGS="--cfg test_$CONFIG_FLAGS"
917

10-
cargo miri test --tests --all-features
18+
cargo miri test --tests --lib

ci/sanitizer.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ set -ex
55
export ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0"
66

77
# Run address sanitizer
8-
RUSTFLAGS="-Z sanitizer=address" \
8+
RUSTFLAGS="-Z sanitizer=address --cfg all_tests" \
99
cargo test --tests --target x86_64-unknown-linux-gnu --all-features
1010

1111
# Run leak sanitizer
12-
RUSTFLAGS="-Z sanitizer=leak" \
12+
RUSTFLAGS="-Z sanitizer=leak --cfg all_tests" \
13+
cargo test --tests --target x86_64-unknown-linux-gnu --all-features
14+
15+
# Run memory sanitizer
16+
RUSTFLAGS="-Z sanitizer=memory --cfg all_tests" \
1317
cargo test --tests --target x86_64-unknown-linux-gnu --all-features
1418

1519
# Run thread sanitizer
16-
RUSTFLAGS="-Z sanitizer=thread" \
20+
RUSTFLAGS="-Z sanitizer=thread --cfg all_tests" \
1721
cargo -Zbuild-std test --tests --target x86_64-unknown-linux-gnu --all-features

ci/sanitizer_generic.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)