Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed Sep 15, 2024
1 parent f2a98ab commit e1deb93
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 41 deletions.
38 changes: 24 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ jobs:
matrix:
os:
- ubuntu-latest
# - macos-latest
# - windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -214,10 +212,6 @@ jobs:
run: cargo install cargo-hack
- name: ASAN / LSAN / TSAN (Linux)
run: ci/sanitizer.sh
if: matrix.os == 'ubuntu-latest'
- name: ASAN / LSAN / TSAN
run: ci/sanitizer_generic.sh
if: matrix.os != 'ubuntu-latest'

miri-tb:
name: miri-tb
Expand All @@ -227,6 +221,12 @@ jobs:
- ubuntu-latest
- macos-latest
- windows-latest
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
cfg:
- all_tests
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -243,11 +243,13 @@ jobs:
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Miri (Linux)
run: ci/miri_tb.sh
run: |
bash ci/miri_tb.sh ${{ matrix.target }} ${{ matrix.cfg }}
if: matrix.os == 'ubuntu-latest'
- name: Miri
run: ci/miri_tb_generic.sh
if: matrix.os != 'ubuntu-latest'
- name: Miri (macOS)
run: |
bash ci/miri_tb_generic.sh ${{ matrix.cfg }}
if: matrix.os == 'macos-latest'

miri-sb:
name: miri-sb
Expand All @@ -257,6 +259,12 @@ jobs:
- ubuntu-latest
- macos-latest
- windows-latest
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
cfg:
- all_tests
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -273,11 +281,13 @@ jobs:
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Miri (Linux)
run: ci/miri_sb.sh
run: |
bash ci/miri_sb.sh ${{ matrix.target }} ${{ matrix.cfg }}
if: matrix.os == 'ubuntu-latest'
- name: Miri
run: ci/miri_sb_generic.sh
if: matrix.os != 'ubuntu-latest'
- name: Miri (macOS)
run: |
bash ci/miri_sb_generic.sh ${{ matrix.cfg }}
if: matrix.os == 'macos-latest'

loom:
name: loom
Expand Down
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ rpath = false
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[lints.rust]
rust_2018_idioms = "warn"
single_use_lifetimes = "warn"
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(all_tests)',
] }
20 changes: 16 additions & 4 deletions ci/miri_sb.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
#!/bin/bash
set -e

# Check if TARGET and CONFIG_FLAGS are provided, otherwise panic
if [ -z "$1" ]; then
echo "Error: TARGET is not provided"
exit 1
fi

if [ -z "$2" ]; then
echo "Error: CONFIG_FLAGS are not provided"
exit 1
fi

TARGET=$1
CONFIG_FLAGS=$2

rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup

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

cargo miri test --tests --target x86_64-unknown-linux-gnu --all-features
# cargo miri test --tests --target aarch64-unknown-linux-gnu #crossbeam_utils has problem on this platform
cargo miri test --tests --target i686-unknown-linux-gnu --all-features
cargo miri test --tests --target powerpc64-unknown-linux-gnu --all-features
cargo miri test --tests --target $TARGET --lib
10 changes: 9 additions & 1 deletion ci/miri_sb_generic.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/bin/bash
set -e

if [ -z "$1" ]; then
echo "Error: CONFIG_FLAGS are not provided"
exit 1
fi

CONFIG_FLAGS=$1

rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup

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

cargo miri test --tests --all-features
cargo miri test --tests --lib
21 changes: 17 additions & 4 deletions ci/miri_tb.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
#!/bin/bash
set -e

# Check if TARGET and CONFIG_FLAGS are provided, otherwise panic
if [ -z "$1" ]; then
echo "Error: TARGET is not provided"
exit 1
fi

if [ -z "$2" ]; then
echo "Error: CONFIG_FLAGS are not provided"
exit 1
fi

TARGET=$1
CONFIG_FLAGS=$2

rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup

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

cargo miri test --tests --target $TARGET --lib

cargo miri test --tests --target x86_64-unknown-linux-gnu --all-features
# cargo miri test --tests --target aarch64-unknown-linux-gnu #crossbeam_utils has problem on this platform
cargo miri test --tests --target i686-unknown-linux-gnu --all-features
cargo miri test --tests --target powerpc64-unknown-linux-gnu --all-features
10 changes: 9 additions & 1 deletion ci/miri_tb_generic.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/bin/bash
set -e

if [ -z "$1" ]; then
echo "Error: CONFIG_FLAGS are not provided"
exit 1
fi

CONFIG_FLAGS=$1

rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup

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

cargo miri test --tests --all-features
cargo miri test --tests --lib
10 changes: 7 additions & 3 deletions ci/sanitizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ set -ex
export ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0"

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

# Run leak sanitizer
RUSTFLAGS="-Z sanitizer=leak" \
RUSTFLAGS="-Z sanitizer=leak --cfg all_tests" \
cargo test --tests --target x86_64-unknown-linux-gnu --all-features

# Run memory sanitizer
RUSTFLAGS="-Z sanitizer=memory --cfg all_tests" \
cargo test --tests --target x86_64-unknown-linux-gnu --all-features

# Run thread sanitizer
RUSTFLAGS="-Z sanitizer=thread" \
RUSTFLAGS="-Z sanitizer=thread --cfg all_tests" \
cargo -Zbuild-std test --tests --target x86_64-unknown-linux-gnu --all-features
14 changes: 0 additions & 14 deletions ci/sanitizer_generic.sh

This file was deleted.

0 comments on commit e1deb93

Please sign in to comment.