From 78ff8eefb25ad7ddc94321723c7a2db6d3790ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A4r=20Berge?= Date: Tue, 17 Dec 2024 13:56:24 +0100 Subject: [PATCH 1/2] Configure test coverage * Install via cargo * Change arguments * Add codecov config --- .github/workflows/rust.yml | 9 +++++---- codecov.yml | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index cd821c80..2ebdc9b8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -20,18 +20,19 @@ jobs: steps: - uses: actions/checkout@v4 - - name: download grcov for code coverage - run: curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - - name: install llvm tools preview run: rustup component add llvm-tools-preview + - name: install grcov + run: cargo install grcov --root . - name: Build run: cargo build --all-features - name: Run tests - run: LLVM_PROFILE_FILE="your_name-%p-%m.profraw" cargo test --all-features + run: LLVM_PROFILE_FILE="rust-ocpp-%p-%m.profraw" cargo test --all-features - name: Generate lcov.info for Code coverage - run: ./grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info + run: ./bin/grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "src/tests/*" -o lcov.info - name: Codecov uses: codecov/codecov-action@v5.1.1 with: files: ./lcov.info token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..b731664c --- /dev/null +++ b/codecov.yml @@ -0,0 +1,19 @@ +comment: + layout: "condensed_header, diff, flags, components" + +component_management: + individual_components: + - component_id: v1.6 + name: v.1.6 + paths: + - src/v1_6 + - component_id: v2.0 + name: v.2.0.1 + paths: + - src/v2_0_1 + +coverage: + status: + project: + default: + target: 20% From 8d18bcc26c0967fda3571363afbaab97eb2f3871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A4r=20Berge?= Date: Thu, 19 Dec 2024 13:39:45 +0100 Subject: [PATCH 2/2] Test changing args --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2ebdc9b8..4127fa57 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -29,7 +29,7 @@ jobs: - name: Run tests run: LLVM_PROFILE_FILE="rust-ocpp-%p-%m.profraw" cargo test --all-features - name: Generate lcov.info for Code coverage - run: ./bin/grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "src/tests/*" -o lcov.info + run: ./bin/grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info - name: Codecov uses: codecov/codecov-action@v5.1.1 with: