Skip to content

Commit c2c077a

Browse files
committed
CI improvements
- cache test builds - retry once if a test fails - replace fail-fast with a maximum of 3 test failures - test timeout after 1h 30m - parallel test execution
1 parent 128c0ac commit c2c077a

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

.github/workflows/test.yaml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,27 @@ name: test
88

99
jobs:
1010
test_with_codecov:
11-
name: Run tests with coverage reporting
11+
name: Run tests coverage (Partition ${{ matrix.partition }}/${{ strategy.job-total }})
1212
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
partition: [1, 2, 3, 4, 5, 6, 7, 8]
1316
steps:
1417
- name: Checkout
1518
uses: actions/checkout@v4
1619

1720
- name: Install protobuf compiler
1821
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
1922

23+
- name: Cache
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/.cargo/registry
28+
~/.cargo/git
29+
target
30+
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
31+
2032
- name: Install Rust toolchain
2133
uses: dtolnay/rust-toolchain@stable
2234
with:
@@ -28,14 +40,23 @@ jobs:
2840
- name: Install cargo-nextest
2941
uses: taiki-e/install-action@nextest
3042

43+
- name: Setup nextest config
44+
run: |
45+
mkdir -p .config
46+
cat <<'EOF' > .config/nextest.toml
47+
[profile.default]
48+
global-timeout = "1h30m"
49+
slow-timeout = "3m"
50+
EOF
51+
3152
- name: Run cargo-llvm-cov
3253
run: |
3354
mkdir -p ./coverage/reports/
34-
cargo llvm-cov nextest --lib --bins --tests --fail-fast --features integration-test --no-capture
35-
cargo llvm-cov report --cobertura --output-path ./coverage/reports/cobertura.xml
36-
55+
cargo llvm-cov nextest --lib --bins --tests --retries 1 --max-fail 3:immediate --partition hash:${{ matrix.partition }}/${{strategy.job-total}} --features integration-test --no-capture
56+
cargo llvm-cov report --cobertura --output-path ./coverage/reports/cobertura-${{ strategy.job-index }}.xml
57+
3758
- name: Upload coverage to Codecov
3859
uses: codecov/codecov-action@v4
3960
with:
4061
token: ${{ secrets.CODECOV_TOKEN }}
41-
file: ./coverage/reports/cobertura.xml
62+
files: ./coverage/reports/cobertura-${{ strategy.job-index }}.xml

codecov.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
codecov:
2+
notify:
3+
after_n_builds: 8
4+
comment:
5+
after_n_builds: 8
16
coverage:
27
status:
38
project:

0 commit comments

Comments
 (0)