From 74b31f5a2dba1f90d97293d187c799fddda6f63e Mon Sep 17 00:00:00 2001 From: Nikki B Date: Tue, 9 Sep 2025 08:39:10 +0100 Subject: [PATCH] chore: add codecov.yml. check it posts comment --- .github/codecov.yml | 9 ++++++++ .github/workflows/build-test.yaml | 36 ++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000000..dd7c551c59 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,9 @@ +# Settings via https://docs.codecov.com/docs/common-recipe-list +coverage: + status: + project: + default: + informational: true +comment: + layout: " diff, flags, files" + behavior: default \ No newline at end of file diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 5ae9e1a81f..a31f9262aa 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -130,6 +130,9 @@ jobs: # Use fixed OS version because we install packages on the system. runs-on: ubuntu-22.04 if: ${{ !github.event.pull_request.draft }} + env: + RUSTFLAGS: "-Cinstrument-coverage" + LLVM_PROFILE_FILE: "concordium-node-%p-%m.profraw" strategy: matrix: @@ -168,7 +171,7 @@ jobs: profile: minimal toolchain: ${{ matrix.plan.rust }} override: true - components: clippy + components: clippy, llvm-tools target: x86_64-pc-windows-gnu - name: Cache cargo dependencies and targets uses: actions/cache@v4 @@ -242,9 +245,15 @@ jobs: run: | cargo check --locked --manifest-path collector/Cargo.toml - name: Check that the Windows node runner service compiles (gnu toolchain, disable embedded resources) + # Instrument coverage flag doesn't seem to be supported in windows target + env: + RUSTFLAGS: "" run: | cargo check --locked --target x86_64-pc-windows-gnu --manifest-path service/windows/Cargo.toml --workspace --no-default-features - name: Check that the Windows installer custom action library compiles (gnu toolchain) + # Instrument coverage flag doesn't seem to be supported in windows target + env: + RUSTFLAGS: "" run: | cargo check --locked --target x86_64-pc-windows-gnu --manifest-path service/windows/installer/custom-actions/Cargo.toml --workspace - name: Run clippy (without extra features) @@ -260,9 +269,15 @@ jobs: run: | cargo clippy --locked --manifest-path collector/Cargo.toml -- -D warnings - name: Run clippy on Windows node runner service + # Instrument coverage flag doesn't seem to be supported in windows? + env: + RUSTFLAGS: "" run: | cargo clippy --locked --target x86_64-pc-windows-gnu --manifest-path service/windows/Cargo.toml --all --no-default-features -- -D warnings - name: Run clippy on Windows installer custom action library + # Instrument coverage flag doesn't seem to be supported in windows? + env: + RUSTFLAGS: "" run: | cargo clippy --locked --target x86_64-pc-windows-gnu --manifest-path service/windows/installer/custom-actions/Cargo.toml --all -- -D warnings - name: Test Rust crates (without extra features) @@ -271,3 +286,22 @@ jobs: - name: Test Rust crates (with feature 'network_dump') run: | cargo test --manifest-path concordium-node/Cargo.toml --all --features=network_dump + + # WIP: coverage reporting: + - name: Check for .profraw files + run: | + find . -type f -name "*.profraw" + - name: Install cargo-llvm-cov + run: | + cargo +stable install cargo-llvm-cov --locked + - name: Run llvm-cov to produce lcov files + run: | + cargo llvm-cov --manifest-path concordium-node/Cargo.toml --workspace --lcov --output-path lcov.info + - name: Upload coverage to Codecov + # Options documented here: https://github.com/codecov/codecov-action + uses: codecov/codecov-action@v5 + with: + files: lcov.info + fail_ci_if_error: false + + \ No newline at end of file