From 04659f6cb1d0486f35fdc4b6802be5d416a4b352 Mon Sep 17 00:00:00 2001 From: Ernestas Kulik Date: Mon, 2 May 2022 10:13:15 +0300 Subject: [PATCH] github: Report code coverage Closes https://github.com/gluxon/nldl/issues/4 --- .github/workflows/primary.yml | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/primary.yml b/.github/workflows/primary.yml index 56e434d..7935508 100644 --- a/.github/workflows/primary.yml +++ b/.github/workflows/primary.yml @@ -42,10 +42,37 @@ jobs: steps: - uses: actions/checkout@v2 - uses: Swatinem/rust-cache@v1 - - name: Build - run: cargo build --tests --verbose - - name: Run tests - run: cargo test --verbose + - uses: actions-rs/toolchain@v1 + with: + components: llvm-tools-preview + override: true + toolchain: stable + - uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features --no-fail-fast + env: + LLVM_PROFILE_FILE: "nldl-%p-%m.profraw" + RUSTFLAGS: '-Cinstrument-coverage' + - uses: actions-rs/cargo@v1 + with: + command: install + args: grcov + - id: coverage + run: | + grcov \ + --branch \ + --ignore-not-existing \ + --llvm \ + --binary-path=target/debug/ \ + --output-path=target/debug/lcov.info \ + --output-type=lcov \ + --source-dir=. \ + . + echo '::set-output name=report::target/debug/lcov.info' + - uses: codecov/codecov-action@v2 + with: + files: ${{ steps.coverage.outputs.report }} check-readme: runs-on: ubuntu-latest