mirror of
https://github.com/nukesor/pueue
synced 2024-09-30 04:53:37 +00:00
Use cargo nextest to run tests
Cargo nextest is faster, and handles flaky tests (tests that can fail even though nothing changed). Both the regular test run and the coverage run include it.
This commit is contained in:
parent
6ccefcab0e
commit
e355e38f9b
40
.config/nextest.toml
Normal file
40
.config/nextest.toml
Normal file
|
@ -0,0 +1,40 @@
|
|||
# See https://nexte.st/book/configuration.html for format and defaults
|
||||
# Profiles defined here inherit from profile.default
|
||||
|
||||
# profile used in GitHub test runs
|
||||
# - Retry a few times to detect flaky tests
|
||||
# - Call out every test as it finishes, including slow, skipped and flaky tests
|
||||
# - List failures again at the end.
|
||||
# - Run all tests even if some failed.
|
||||
[profile.ci]
|
||||
# "retries" defines the number of times a test should be retried. If set to a
|
||||
# non-zero value, tests that succeed on a subsequent attempt will be marked as
|
||||
# non-flaky. Can be overridden through the `--retries` option.
|
||||
retries = 2
|
||||
|
||||
# * none: no output
|
||||
# * fail: show failed (including exec-failed) tests
|
||||
# * retry: show flaky and retried tests
|
||||
# * slow: show slow tests
|
||||
# * pass: show passed tests
|
||||
# * skip: show skipped tests (most useful for CI)
|
||||
# * all: all of the above
|
||||
#
|
||||
# Each value includes all the values above it; for example, "slow" includes
|
||||
# failed and retried tests.
|
||||
status-level = "all"
|
||||
|
||||
# * "immediate-final": output failures as soon as they happen and at the end of
|
||||
# the test run; combination of "immediate" and "final"
|
||||
failure-output = "immediate-final"
|
||||
|
||||
# Cancel the test run on the first failure. For CI runs, consider setting this
|
||||
# to false.
|
||||
fail-fast = false
|
||||
|
||||
# profile used in GitHub coverage runs
|
||||
# - lower retry count as a compromise between speed and resilience
|
||||
# - no fail-fast to at least keep coverage percentages accurate.
|
||||
[profile.coverage]
|
||||
retries = 1
|
||||
fail-fast = false
|
10
.github/workflows/coverage.yml
vendored
10
.github/workflows/coverage.yml
vendored
|
@ -48,11 +48,15 @@ jobs:
|
|||
restore-keys: |
|
||||
${{ runner.os }}-cargo-${{ matrix.target }}-
|
||||
|
||||
- name: Install cargo-llvm-cov
|
||||
uses: taiki-e/install-action@cargo-llvm-cov
|
||||
- name: Install cargo-llvm-cov and nextest
|
||||
uses: taiki-e/install-action@v1
|
||||
with:
|
||||
tool: cargo-llvm-cov,nextest
|
||||
|
||||
- name: Generate code coverage
|
||||
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
|
||||
env:
|
||||
NEXTEST_PROFILE: coverage # defined in .config/nextest.toml
|
||||
run: cargo llvm-cov nextest --all-features --workspace --lcov --output-path lcov.info
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
|
|
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
|
@ -75,6 +75,9 @@ jobs:
|
|||
components: llvm-tools-preview
|
||||
target: ${{ matrix.target }}
|
||||
|
||||
- name: Install cargo-nextest
|
||||
uses: taiki-e/install-action@nextest
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
|
@ -97,7 +100,9 @@ jobs:
|
|||
- name: cargo test
|
||||
uses: actions-rs/cargo@v1
|
||||
if: ${{ !matrix.cross }}
|
||||
env:
|
||||
NEXTEST_PROFILE: ci # defined in .config/nextest.toml
|
||||
with:
|
||||
command: test
|
||||
args: --workspace --target=${{ matrix.target }}
|
||||
command: nextest
|
||||
args: run --workspace --target=${{ matrix.target }}
|
||||
use-cross: ${{ matrix.cross }}
|
||||
|
|
|
@ -32,6 +32,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||
- Continuation of testing the `pueue` client, pushing the test coverage from ~70% to ~73%.
|
||||
- A codecov.yml syntax error was corrected, which prevented Codecov from applying the
|
||||
repository-specific configuration.
|
||||
- CI tests are now run using cargo nextest, for faster test execution, flaky test handling and better test output.
|
||||
|
||||
## [2.1.0] - 2022-07-21
|
||||
|
||||
|
|
Loading…
Reference in a new issue