Skip to content

Commit

Permalink
Code coverage workflow (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwalcott3 authored Jan 23, 2023
1 parent f11b2c4 commit f0b2047
Show file tree
Hide file tree
Showing 8 changed files with 731 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: code_coverage

on:
push:
branches:
- main
- feature/*
paths-ignore:
- '**.md'

env:
BUILD_TYPE: Debug

jobs:
build:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Set up enviroment
run: |
echo "CXX=clang++-14" >> "$GITHUB_ENV"
echo "CC=clang-14" >> "$GITHUB_ENV"
echo "CXXFLAGS="-fprofile-instr-generate -fcoverage-mapping"" >> "$GITHUB_ENV"
echo "LDFLAGS="-fprofile-instr-generate"" >> "$GITHUB_ENV"
echo "LLVM_PROFILE_FILE="code-%p.profraw"" >> "$GITHUB_ENV"
- name: Have llvm-cov point to llvm-cov-14
run: |
mkdir -p /home/runner/.local/bin
ln -s `which llvm-cov-14` /home/runner/.local/bin/llvm-cov
ln -s `which llvm-profdata-14` /home/runner/.local/bin/llvm-profdata
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Configure CMake with code coverage enabled
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCODE_COVERAGE=ON

- name: Build code coverage target
run: cmake --build build --config ${{env.BUILD_TYPE}} --target ccov-all -j 2

- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: ${{github.workspace}}/build/ccov/all-merged
Loading

0 comments on commit f0b2047

Please sign in to comment.