Add Codecov for Automated Code Coverage (#316)

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

---------

Signed-off-by: Vitah Lin <vitahlin@gmail.com>
Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
This commit is contained in:
Vitah Lin 2024-04-18 13:39:02 +08:00 committed by Harkrishn Patro
parent 4b2edc68ca
commit ae6c6495bf
4 changed files with 47 additions and 1 deletions

24
.github/workflows/codecov.yml vendored Normal file
View File

@ -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-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install lcov and run test
run: |
sudo apt-get install lcov
make lcov
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./src/valkey.info

View File

@ -1,3 +1,5 @@
[![codecov](https://codecov.io/gh/valkey-io/valkey/graph/badge.svg?token=KYYSJAYC5F)](https://codecov.io/gh/valkey-io/valkey)
This README is under construction as we work to build a new community driven high performance key-value store. This README is under construction as we work to build a new community driven high performance key-value store.
This project was forked from the open source Redis project right before the transition to their new source available licenses. This project was forked from the open source Redis project right before the transition to their new source available licenses.

19
codecov.yml Normal file
View File

@ -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

View File

@ -504,8 +504,9 @@ test-cluster: $(REDIS_SERVER_NAME) $(REDIS_CLI_NAME)
check: test check: test
lcov: lcov:
@lcov --version
$(MAKE) gcov $(MAKE) gcov
@(set -e; cd ..; ./runtest --clients 1) @(set -e; cd ..; ./runtest)
@geninfo -o redis.info . @geninfo -o redis.info .
@genhtml --legend -o lcov-html redis.info @genhtml --legend -o lcov-html redis.info