Repository navigation
chore: run tests with ASAN in CI #360
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
base: main
Are you sure you want to change the base?
Changes from all commits
3fc95cb
a4f33f7
5cb7b84
843a54c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,3 +162,57 @@ jobs: | |
| run: >- | ||
| cargo package | ||
| --locked --all-features | ||
|
|
||
| asan: | ||
| strategy: | ||
| # Don't give up on the whole matrix if one variant fails. | ||
| fail-fast: false | ||
| matrix: | ||
| # Only native targets: the sanitizer runtime must run on the build host. | ||
| include: | ||
| - target: aarch64-apple-darwin | ||
| runner_os: macos-15 | ||
|
|
||
| - target: x86_64-unknown-linux-gnu | ||
| runner_os: ubuntu-24.04 | ||
|
|
||
| runs-on: ${{ matrix.runner_os }} | ||
|
|
||
| steps: | ||
| - name: Install Rust toolchain | ||
| # Sanitizers are only available on nightly Rust. | ||
| uses: dtolnay/rust-toolchain@nightly | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like this is going to be a complete noop practically. If the target triple is set to something else other than the system's target triple, it's either going to run fine (e.g.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sgoll Thoughts?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the extra verification is necessary. All the other |
||
|
|
||
| - name: Install cargo-binstall | ||
| uses: cargo-bins/cargo-binstall@main | ||
|
|
||
| - name: Install Cargo helpers | ||
| run: >- | ||
| cargo binstall just | ||
|
|
||
| - name: Use LLVM Clang for native code on macOS | ||
| if: startsWith(matrix.runner_os, 'macos-') | ||
| # Code instrumented by Apple Clang does not link against the sanitizer | ||
| # runtime from the LLVM bundled with Rust (see README of `open62541-sys`). | ||
| run: | | ||
| brew install llvm | ||
| echo "CC=$(brew --prefix llvm)/bin/clang" >> "$GITHUB_ENV" | ||
|
|
||
| # Check out the repository before the remaining steps that depend on it. | ||
| # All preceding steps are independent of the repository contents. | ||
| - name: Check out repository | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Cache Rust toolchain and build artifacts | ||
| uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| # The cache should not be shared between different workflows, jobs, and targets. | ||
| shared-key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.target }}-${{ matrix.runner_os }} | ||
|
|
||
| # The recipe sets the target explicitly, which keeps the sanitizer flags | ||
| # away from build scripts and proc macros. | ||
| - name: Run tests (bins/lib/tests/examples) with AddressSanitizer | ||
| run: >- | ||
| just test-asan | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we switch to
macos-26andubuntu-26.04after the merge of #365?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using
-latestfor bothrunner_os?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would move the new check to
latest-dependencies.yaml. I don't think that's the right spot, though, because that workflow specifically checks whether the library still builds on the latest CI environments and dependencies (runningcargo updatefirst), thus mixing the two cases.So, I'd continue to use fixed versions in
test.yaml, to prevent sudden unexpected failures in the CI due to newly-released runner environments.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we should add a comment to keep the runners pinned at the latest available image, currently
macos-26andubuntu-26.04.