From 5dbcb3e4ab2f540d1c726fc9a49f1df2c91c10ec Mon Sep 17 00:00:00 2001 From: Vitah Lin Date: Mon, 27 Jan 2025 21:04:11 +0800 Subject: [PATCH] Add codecov for automated code coverage (#13393) This PR introduces Codecov to automate code coverage tracking for our project's tests. For more information about the Codecov platform, please refer to https://docs.codecov.com/docs/quick-start --------- Co-authored-by: debing.sun --- .github/workflows/codecov.yml | 24 ++++++++++++++++++++++++ README.md | 2 ++ codecov.yml | 19 +++++++++++++++++++ src/Makefile | 3 ++- 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/codecov.yml create mode 100644 codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 000000000..82656ac31 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,24 @@ +name: "Codecov" + +# Enabling on each push is to display the coverage changes in every PR, +# where each PR needs to be compared against the coverage of the head commit +on: [push, pull_request] + +jobs: + code-coverage: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install lcov and run test + run: | + sudo apt-get install lcov + make lcov + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./src/redis.info diff --git a/README.md b/README.md index 4d6d7adb1..9038f0c0b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![codecov](https://codecov.io/github/redis/redis/graph/badge.svg?token=6bVHb5fRuz)](https://codecov.io/github/redis/redis) + This README is just a fast *quick start* document. You can find more detailed documentation at [redis.io](https://redis.io). What is Redis? diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..05e315dcc --- /dev/null +++ b/codecov.yml @@ -0,0 +1,19 @@ +coverage: + status: + patch: + default: + informational: true + project: + default: + informational: true + +comment: + require_changes: false + require_head: false + require_base: false + layout: "condensed_header, diff, files" + hide_project_coverage: false + behavior: default + +github_checks: + annotations: false diff --git a/src/Makefile b/src/Makefile index 4f394782d..0eb2cf41b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -487,8 +487,9 @@ test-cluster: $(REDIS_SERVER_NAME) $(REDIS_CLI_NAME) check: test lcov: + @lcov --version $(MAKE) gcov - @(set -e; cd ..; ./runtest --clients 1) + @(set -e; cd ..; ./runtest) @geninfo -o redis.info . @genhtml --legend -o lcov-html redis.info