-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add a daily coverage run (#1437)
* Add a coverage workflow to dragonfly. * Try and make the testing permissive * Apply suggestions from code review Signed-off-by: Roy Jacobson <[email protected]> * Remove redundant parts --------- Signed-off-by: Roy Jacobson <[email protected]>
- Loading branch information
1 parent
898061d
commit d12c6e3
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Daily Coverage | ||
|
||
on: | ||
schedule: | ||
- cron: '0 6 * * *' # run at 6 AM UTC | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
# The CMake configure and build commands are platform agnostic and should work equally | ||
# well on Windows or Mac. You can convert this to a matrix build if you need | ||
# cross-platform coverage. | ||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- container: "ubuntu-dev:20" | ||
build-type: Release | ||
compiler: {cxx: g++, c: gcc} | ||
cxx_flags: "-fprofile-arcs -ftest-coverage" | ||
timeout-minutes: 60 | ||
container: | ||
image: ghcr.io/romange/${{ matrix.container }} | ||
credentials: | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- name: Install dependencies | ||
run: | | ||
uname -a | ||
cmake --version | ||
mkdir -p ${{github.workspace}}/build | ||
apt update && apt install -y lcov pip | ||
- name: Cache build deps | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.ccache | ||
${{github.workspace}}/build/_deps | ||
key: ${{ runner.os }}-deps-${{ github.base_ref }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-deps-${{ github.base_ref }}- | ||
- name: Configure CMake | ||
run: | | ||
pip install -r tests/dragonfly/requirements.txt | ||
cmake -B build \ | ||
-DCMAKE_BUILD_TYPE=${{matrix.build-type}} \ | ||
-GNinja \ | ||
-DCMAKE_C_COMPILER="${{matrix.compiler.c}}" \ | ||
-DCMAKE_CXX_COMPILER="${{matrix.compiler.cxx}}" \ | ||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | ||
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}}" \ | ||
-L | ||
pwd | ||
cd build && pwd | ||
- name: Build & Test Coverage | ||
run: | | ||
cd $GITHUB_WORKSPACE/build | ||
ninja | ||
# Be permissive with errors, we hit compiler bugs from time to time. | ||
ninja test || true | ||
export DRAGONFLY_PATH=`pwd`/dragonfly | ||
pytest ../tests/dragonfly/ || true | ||
lcov -c -d . -o main_coverage.info | ||
lcov --remove main_coverage.info -o main_coverage.info '/usr/*' '*/_deps/*' '*/third_party/*' | ||
genhtml main_coverage.info --ignore-errors source --output-directory covout -p $GITHUB_WORKSPACE | ||
ls ./ | ||
echo ls covout | ||
ls covout/ | ||
- name: Upload coverage | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-report | ||
path: build/covout/ | ||
if-no-files-found: error |