This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
55 lines (50 loc) · 1.8 KB
/
unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Run Unit Tests and Coverage
on: [push, pull_request]
env:
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache
jobs:
code-coverage:
runs-on: ubuntu-20.04
env:
CC: gcc-9
CXX: g++-9
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache dependencies
uses: actions/cache@v2
env:
cache-name: cache-deps
with:
path: .cache/deps
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/ThirdPartyDeps.cmake') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache build
uses: actions/cache@v2
env:
cache-name: cache-build
with:
path: .cache/sccache
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Install sccache
run: |
curl -SL https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xvz --strip-components=1 --wildcards "*/sccache"
chmod +x sccache
- name: Install Lcov
run: sudo apt install lcov ninja-build
- name: CMake configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON -DENABLE_TESTING=ON
- name: CMake build
run: cmake --build build --config Debug -j --clean-first
- name: CTest
working-directory: build/
run: ctest --output-on-failure
- name: Generate Coverage Report
run: bash ./scripts/run_coverage.sh
- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"