diff --git a/.github/workflows/test_suite.yml b/.github/workflows/test_suite.yml index 050e18e..56009f5 100644 --- a/.github/workflows/test_suite.yml +++ b/.github/workflows/test_suite.yml @@ -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 @@ -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: