Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add miri testing #8426

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/actions/rustup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ inputs:
default: false
required: false
type: boolean
miri:
default: false
required: false
type: boolean
save-cache:
default: false
required: false
Expand Down Expand Up @@ -56,6 +60,11 @@ runs:
shell: bash
run: rustup set profile minimal

- name: Add Miri
shell: bash
if: ${{ inputs.miri == 'true' }}
run: rustup component add miri

- name: Add Clippy
shell: bash
if: ${{ inputs.clippy == 'true' }}
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,35 @@ jobs:
# reason for excluding https://github.com/napi-rs/napi-rs/issues/2200
run: cargo test --workspace --exclude rspack_binding_options --exclude rspack_node -- --nocapture

rust_test_miri:
name: Rust test miri
needs: [get-runner-labels, rust_changes]
if: ${{ needs.rust_changes.outputs.changed == 'true' }}
runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
steps:
- uses: actions/checkout@v4

- name: Pnpm Cache # Required by some tests
uses: ./.github/actions/pnpm-cache

- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
save-cache: ${{ github.ref_name == 'main' }}
shared-key: check
miri: true

# Compile test without debug info for reducing the CI cache size
- name: Change profile.test
shell: bash
run: |
echo '[profile.test]' >> Cargo.toml
echo 'debug = false' >> Cargo.toml

- name: Run test
# reason for excluding https://github.com/napi-rs/napi-rs/issues/2200
run: cargo miri test --workspace --exclude rspack_binding_options --exclude rspack_node -- --nocapture

run_benchmark:
name: Run benchmark
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions crates/rspack_allocator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use mimalloc::MiMalloc;

#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
#[cfg(not(miri))]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
Loading