From 3ee57a0a6134461fba95bdb42f24d918ccfd39fb Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 5 Oct 2021 21:47:02 +0200 Subject: [PATCH] ci: upload test coverage on codecov.io --- .github/workflows/check.yaml | 50 +++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 38917777f..6d92f3a7b 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -60,6 +60,7 @@ jobs: command: fetch args: --locked + lsif: name: Generate LSIF index and upload it to Sourcegraph needs: [fetch] @@ -71,7 +72,6 @@ jobs: uses: actions/checkout@v2 - name: Install toolchain - id: toolchain uses: actions-rs/toolchain@v1 with: toolchain: nightly @@ -104,6 +104,7 @@ jobs: run: | src lsif upload -file=./dump.lsif -indexer=rust-analyzer -repo="github.com/${GITHUB_REPOSITORY}" -commit="${GITHUB_SHA}" -github-token="${{ secrets.GITHUB_TOKEN }}" + rustfmt: name: Check style needs: [fetch] @@ -241,6 +242,53 @@ jobs: command: test args: --offline + + coverage: + name: Code coverage + needs: [rustfmt, clippy, fetch] + runs-on: ubuntu-latest + + steps: + - name: Checkout the code + uses: actions/checkout@v2 + + - name: Install toolchain + id: toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: x86_64-unknown-linux-musl + override: true + + - name: Setup Cargo cache + uses: actions/cache@v2.1.6 + with: + path: | + ~/.cargo/registry/index + ~/.cargo/registry/cache + ~/.cargo/git/db + key: ${{ runner.os }}-cargo-deps-msrv-${{ hashFiles('**/Cargo.lock') }} + + - name: Setup build cache + uses: actions/cache@v2.1.6 + with: + path: | + target + key: ${{ runner.os }}-cargo-coverage-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-coverage-${{ steps.toolchain.outputs.rustc_hash }}- + ${{ runner.os }}-cargo-coverage- + + - name: Run cargo tarpaulin + uses: actions-rs/tarpaulin@v0.1 + with: + version: '0.18.2' + args: '--avoid-cfg-tarpaulin' + + - name: Upload to codecov.io + uses: codecov/codecov-action@v2 + + build-image: name: Build and push Docker image needs: [rustfmt, clippy]