Skip to content

enable coverage test for github action #7

enable coverage test for github action

enable coverage test for github action #7

Workflow file for this run

name: Coverage Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
coverage:
name: Test Coverage
runs-on: ubuntu-latest
container:
image: vsaglib/vsag:ubuntu
steps:
- name: Checkout code
- uses: actions/checkout@v4
- name: Load Cache
uses: actions/[email protected]
with:
path: ./build/
key: build-${{ hashFiles('./CMakeLists.txt') }}-${{ hashFiles('./.circleci/fresh_ci_cache.commit') }}
- name: Compile
run: make cov
- name: Run Test
run: |
./scripts/test_parallel_bg.sh
./build/mockimpl/tests_mockimpl -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
# - name: Collect Coverage Info
# run: bash scripts/collect_cpp_coverage.sh
# - name: Generate HTML
# run: genhtml --output-directory coverage/coverage/html coverage/coverage.info
# - name: Upload HTML coverage report
# uses: actions/upload-artifact@v4
# with:
# name: coverage-report-${{ github.run_id }}
# path: coverage/html/
# compression-level: 1
# retention-days: 3
# overwrite: 'true'
# - name: Set Threshold
# run: |
# line_coverage=`lcov --summary coverage/coverage.info | grep "lines......" | awk '/lines/ { print $2 }' | cut -d '%' -f 1`
# line_coverage=$(printf "%.0f" $line_coverage)
# if [ "$line_coverage" -gt 84 ]; then
# echo "line coverage is ${line_coverage}, more than 85"
# exit 0;
# else
# echo "line coverage is ${line_coverage}, less than 85"
# exit 1;
# fi