Skip to content

Commit

Permalink
new(ci): add code coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Guerra <[email protected]>
  • Loading branch information
LucaGuerra authored and poiana committed Jul 19, 2024
1 parent ae6b268 commit 69c9dd9
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/test_coverage_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test Coverage CI
on:
pull_request:
push:
branches:
- master

# Checks if any concurrent jobs under the same pull request or branch are being executed
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
unit-test-libsinsp-coverage:
name: unit-test-libsinsp-coverage 🧐
runs-on: 'ubuntu-22.04'
container:
image: debian:buster
steps:
- name: Install deps ⛓️
run: |
apt update && apt install -y --no-install-recommends ca-certificates \
cmake build-essential git clang llvm pkg-config autoconf automake \
libtool libelf-dev wget libc-ares-dev libcurl4-openssl-dev libssl-dev \
libtbb-dev libjq-dev libjsoncpp-dev libgrpc++-dev protobuf-compiler-grpc \
libgtest-dev libprotobuf-dev linux-headers-amd64 \
gcovr
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Install deps ⛓️
run: |
.github/install-deps.sh
- name: Git safe directory
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Build and test 🏗️🧪
run: |
mkdir -p build
cd build && cmake -DBUILD_WARNINGS_AS_ERRORS=True -DENABLE_COVERAGE=True -DUSE_BUNDLED_DEPS=False ../
KERNELDIR=/lib/modules/$(ls /lib/modules)/build make -j4
make run-unit-tests
- name: Generate libsinsp coverage report
run: |
gcovr --filter ".*/userspace/libsinsp/.*" --exclude ".*/third-party/.*" --xml -o ./libsinsp.coverage.xml

0 comments on commit 69c9dd9

Please sign in to comment.