diff --git a/.config/nextest.toml b/.config/nextest.toml new file mode 100644 index 0000000..9dab67e --- /dev/null +++ b/.config/nextest.toml @@ -0,0 +1,17 @@ +[profile.default] + +# To deal with the flaky integration tests, we set a retry policy. +# but if a test fails more than 3 times, it's safe to assume it's failing deterministically +# and that's a reliable indication that we shouldn't merge this PR +retries = { backoff = "fixed", count = 3, delay = "2s" } + +# only run one test at a time, which allows a human-friendly experience for inspecting logs +test-threads = 1 + +# label as slow if a test runs for more than 60s +# kill it after 120s +slow-timeout = { period = "60s", terminate-after = 2 } + +# display status for all levels (pass, fail, flaky, slow, etc) +status-level = "all" +final-status-level = "all" \ No newline at end of file diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..0e94bbd --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,39 @@ +name: Coverage + +on: + push: + branches: + - main + +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Cache Rust dependencies + uses: actions/cache@v4 + with: + path: ~/.cargo/registry, ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Set up Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + rust-version: stable + + - name: Install cargo-tarpaulin + run: cargo install cargo-tarpaulin + + - name: Run coverage with cargo-tarpaulin + run: cargo tarpaulin --out Xml + + - name: Upload coverage results to Codecov + uses: codecov/codecov-action@v5 + with: + file: ./target/debug/deps/coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} + if: success() diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml index 97a7de7..a84aa21 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -29,8 +29,12 @@ jobs: with: rust-version: stable + - name: Install cargo-nextest + run: cargo install cargo-nextest --locked + + - name: Run tests on the root project - run: cargo test --workspace + run: cargo nextest run - name: Run tests on example crates run: | @@ -40,17 +44,3 @@ jobs: (cd $example && cargo test) fi done - - - name: Install cargo-tarpaulin for coverage - run: cargo install cargo-tarpaulin - - - name: Run coverage with cargo-tarpaulin - run: cargo tarpaulin --out Xml - if: success() - - - name: Upload coverage results to Codecov - uses: codecov/codecov-action@v5 - with: - file: ./target/debug/deps/coverage.xml - token: ${{ secrets.CODECOV_TOKEN }} - if: success()