This repository has been archived by the owner on Feb 15, 2024. It is now read-only.
Merge pull request #221 from subspace/update-oct-3 #100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code coverage | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
- '.gitignore' | |
env: | |
# Not needed in CI, should make things a bit faster | |
CARGO_INCREMENTAL: 0 | |
CARGO_TERM_COLOR: always | |
MAX_TARGET_SIZE: 1024 # MB | |
jobs: | |
code-coverage: | |
runs-on: ${{ fromJson(github.repository_owner == 'subspace' && '["self-hosted", "ubuntu-20.04-x86-64"]' || 'ubuntu-22.04') }} | |
steps: | |
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@9b1ee5b22b0a3f1feb8c2ff99b32c89b3c3191e9 # v2.0.0 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install LLVM and Clang | |
uses: KyleMayes/install-llvm-action@8852e4d5c58653ed05135c0a5d949d9c2febcb00 # v1.6.1 | |
with: | |
version: "15.0" | |
- name: Add cache | |
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/bin | |
~/.cargo/git | |
target | |
key: coverage-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: coverage-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Install utils for caching | |
run: | | |
test -x ~/.cargo/bin/cargo-sweep || cargo install cargo-sweep | |
test -x ~/.cargo/bin/cargo-cache || cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache | |
- name: Clean unused crate source checkouts and git repo checkouts | |
run: cargo cache | |
- name: cargo install cargo-tarpaulin | |
run: test -x ~/.cargo/bin/cargo-tarpaulin || cargo install cargo-tarpaulin | |
- name: Generate code coverage | |
run: cargo tarpaulin --verbose --timeout $((2 * 60 * 60)) --out Xml --release --locked | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 | |
with: | |
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
fail_ci_if_error: true | |
- name: Clean unused artifacts | |
run: cargo sweep --maxsize ${{ env.MAX_TARGET_SIZE }} |