Skip to content

add coverage test in .yml file #8

add coverage test in .yml file

add coverage test in .yml file #8

Workflow file for this run

name: Code Coverage
# Run it when you push to all branches
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build binary files
run: |
make build
coverage:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install gcov
run: |
if ! command -v gcov &>/dev/null; then
echo "gcov is not installed. Installing..."
sudo apt-get update
sudo apt-get install -y gcov
fi
echo "gcov is installed."
- name: Generate Coverage
run: |
COVERAGE=$(make coverage | grep 'TOTAL COVERAGE' | grep -Eo '[0-9]+')
if [ "$COVERAGE" -gt 89 ]; then
echo "success"
else
echo "failure"
fi