Skip to content

Commit

Permalink
ci: attempt to add codecoverage
Browse files Browse the repository at this point in the history
  • Loading branch information
timvw committed Mar 29, 2024
1 parent 87b84fd commit 72085fe
Showing 1 changed file with 42 additions and 3 deletions.
45 changes: 42 additions & 3 deletions .github/workflows/test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,40 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
components: llvm-tools-preview

- name: Install grcov
uses: taiki-e/install-action@v2
with:
tool: grcov

- name: Build
run: cargo build --verbose --all-targets
env:
RUSTFLAGS: "-Cinstrument-coverage"

- name: Start minio
run: ./ci/minio_start.sh
- run: cargo test --all-features -- -Z unstable-options --format json --report-time | tee results.json

- name: Test
run: cargo test --all-features -- -Z unstable-options --format json --report-time | tee results.json
env:
LLVM_PROFILE_FILE: "target/coverage/prof/%p-%m.profraw"
RUSTFLAGS: "-Cinstrument-coverage"

- name: Stop minio
run: ./ci/minio_stop.sh

- name: Prepare junit report
id: cargo_reporter
uses: innoq/action-cargo-test-report@v1
with:
cargo-test-report-json: 'results.json'

- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: always() # always run even if the previous step fails
Expand All @@ -44,8 +67,24 @@ jobs:
require_tests: true
annotate_only: true
summary: ${{ steps.cargo_reporter.outputs.summary }}
- name: Stop minio
run: ./ci/minio_stop.sh

- name: Create coverage report
run: |
grcov \
--source-dir . \
--binary-path target/debug \
--branch \
--excl-start 'mod tests \{' \
--ignore 'tests/*' \
-t lcov \
-o lcov.info \
target/coverage/prof
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: false

# Check formatting with rustfmt
formatting:
Expand Down

0 comments on commit 72085fe

Please sign in to comment.