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

ci: use nextest for running rust tests #2031

Merged
merged 1 commit into from
May 18, 2022
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
13 changes: 13 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[profile.ci]
# Print out output for failing tests as soon as they fail, and also at the end
# of the run (for easy scrollability).
failure-output = "immediate-final"
# Show skipped tests in the CI output.
status-level = "skip"
# Do not cancel the test run on the first failure.
fail-fast = false
# Retry failing tests in order to not block builds on flaky tests
retries = 2

[profile.ci.junit]
path = "junit.xml"
Comment on lines +12 to +13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what we would use this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generates a junit file that could be later used in order to analyze the test run to do things like open up issues for flaky tests, etc

It's unused now

14 changes: 5 additions & 9 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,13 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
# Disable caching on self-hosted jobs
# Enable caching of the 'librocksdb-sys' crate by additionally caching the
# 'librocksdb-sys' src directory which is managed by cargo
# - uses: bmwill/rust-cache@v1 # Fork of 'Swatinem/rust-cache' which allows caching additional paths
# with:
# path: ~/.cargo/registry/src/**/librocksdb-sys-*
- uses: taiki-e/install-action@nextest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the latest advice is to use baptiste0928/cargo-installdue to its superior caching.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually downloading pre-compiled binary so caching isn't even needed.

- name: cargo test
run: |
cargo build --all-features --lib
cargo test --all-features --no-run # -j N # uncomment and set a low number if builds start OOMing again
cargo test --all-features
cargo nextest run --all-features --profile ci
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use the --config-file option here to make sure our custom config file is always taken into account? (w/o relying on default location that is, since it's relative to the workspace root .. imagine if we move everything to crates/)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with everything moved to crates/ directory we'd still keep the repo root as the workspace root I'd think

- name: Doctests
run: |
cargo test --doc --all-features
# Ensure there are no uncommitted changes in the repo after running tests
- run: scripts/changed-files.sh

Expand Down