From 4a40f5419ac25cd42106ea50ba3203a8f9720a97 Mon Sep 17 00:00:00 2001 From: clabby Date: Tue, 11 Jun 2024 09:33:28 -0400 Subject: [PATCH] feat(ci): Add codecov (#233) Adds codecov to CI --- .github/codecov.yml | 25 +++++++++++++++++++++++++ .github/workflows/rust_ci.yaml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 000000000..84e90bbd5 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,25 @@ +# ref: https://docs.codecov.com/docs/codecovyml-reference +coverage: + # TODO: Raise coverage requirements + range: 25..100 + round: down + precision: 1 + status: + # ref: https://docs.codecov.com/docs/commit-status + project: + default: + # Avoid false negatives + threshold: 1% + +ignore: + - "tests" + - "test_util*" + - "test_utils" + - "bin/programs/minimal" + - "bin/programs/simple-revm" + +# Make comments less noisy +comment: + layout: "condensed_header, condensed_files, condensed_footer" + require_changes: true + hide_project_coverage: false diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml index a008e21e5..51efe9b4d 100644 --- a/.github/workflows/rust_ci.yaml +++ b/.github/workflows/rust_ci.yaml @@ -96,3 +96,36 @@ jobs: run: just lint-docs - name: doctest run: just test-docs + coverage: + runs-on: ubuntu-latest + name: codecov + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Install stable + uses: dtolnay/rust-toolchain@stable + with: + components: llvm-tools-preview + - name: Rust cache + uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - name: cargo install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: cargo install cargo-nextest + uses: taiki-e/install-action@nextest + - name: cargo generate-lockfile + if: hashFiles('Cargo.lock') == '' + run: cargo generate-lockfile + - name: cargo llvm-cov + run: cargo llvm-cov nextest --locked --workspace --lcov --output-path lcov.info + - name: Record Rust version + run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV" + - name: Upload to codecov.io + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + env_vars: OS,RUST + files: lcov.info