-
Notifications
You must be signed in to change notification settings - Fork 67
71 lines (65 loc) · 2.37 KB
/
main.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Build with CMake and Test
run-name: Build FastANI with CMake and Test by ${{github.actor}}
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
# Allows to run this workflow from the Actions tab (w.o. trigger)
workflow_dispatch:
env:
# CMake build type (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
jobs:
Build-Test:
permissions: write-all
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
lfs: true
- name: Install zlib, gsl, cppcheck and lcov
run: |
sudo apt-get update
sudo apt-get install zlib1g-dev libgsl-dev cppcheck lcov
# Static Analysis with cppcheck
- name: cppcheck
run: cppcheck --enable=all --inconclusive --force --std=c++20 -iext/ -I src/ --output-file=cppcheck_report.txt .
- name: Upload CPPCheck Report as artifact
uses: actions/upload-artifact@v3
with:
name: CPPCheck-Report
path: ${{github.workspace}}/cppcheck_report.txt
# Building
- name: Configure CMake
# https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Testing
- name: Test
working-directory: ${{github.workspace}}/build
# https://cmake.org/cmake/help/latest/manual/ctest.1.html
run: ctest -C ${{env.BUILD_TYPE}}
# Run code coverage
- name: Run lcov to generate coverage
working-directory: ${{github.workspace}}/build
run: make lcov2
# Uploading to Codecov
- name: Upload coverage reports to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ${{github.workspace}}/build
files: ${{github.workspace}}/build/coverage.info
fail_ci_if_error: true
verbose: true
# Uploading to Github Action as artifact
- name: Upload Coverage Summary as artifact
uses: actions/upload-artifact@v3
with:
name: Coverage-Summary
path: ${{github.workspace}}/build/coverage_list.txt
retention-days: 5