Skip to content

Commit

Permalink
shard rust unit tests on ci (#5578)
Browse files Browse the repository at this point in the history
* shard rust unit tests on ci

uses nextest as a test runner and llvm-cov as the coverage reporter. neither
the default test runner nor cargo tarpaulin support sharding, so opting to use
nextest for this purpose.

* try removing clean artifact step
  • Loading branch information
mat-if authored Oct 24, 2024
1 parent 4229f77 commit aa47db1
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/rust_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,34 @@ jobs:
ironfish_rust:
name: Test ironfish-rust
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1/2, 2/2]

steps:
- uses: actions/checkout@v4

- name: install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Install nextest
uses: taiki-e/install-action@nextest

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
shared-key: base

# Run tests to collect code coverage
- name: Run cargo-tarpaulin on ironfish-rust
- name: Run tests
run: |
wget -O tarpaulin.tar.gz https://github.com/xd009642/tarpaulin/releases/download/0.22.0/cargo-tarpaulin-0.22.0-travis.tar.gz
tar -xzf tarpaulin.tar.gz
mv cargo-tarpaulin ~/.cargo/bin/
cargo tarpaulin -p ironfish --release --out Xml --avoid-cfg-tarpaulin --skip-clean --timeout 300 -- --test-threads 1
cargo llvm-cov nextest \
--no-clean \
--codecov \
--output-path codecov.json \
--package ironfish \
--release \
--partition count:${{ matrix.shard }}
# Upload code coverage to Codecov
- name: Upload to codecov.io
Expand All @@ -116,18 +129,26 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Install nextest
uses: taiki-e/install-action@nextest

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
shared-key: zkp

# Run tests to collect code coverage
- name: Run cargo-tarpaulin on ironfish-zkp
- name: Run tests
run: |
wget -O tarpaulin.tar.gz https://github.com/xd009642/tarpaulin/releases/download/0.22.0/cargo-tarpaulin-0.22.0-travis.tar.gz
tar -xzf tarpaulin.tar.gz
mv cargo-tarpaulin ~/.cargo/bin/
cargo tarpaulin -p ironfish_zkp --release --out Xml --avoid-cfg-tarpaulin --skip-clean --timeout 300 -- --test-threads 1
cargo llvm-cov nextest \
--no-clean \
--codecov \
--output-path codecov.json \
--package ironfish_zkp \
--release
# Upload code coverage to Codecov
- name: Upload to codecov.io
Expand Down

0 comments on commit aa47db1

Please sign in to comment.