-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (81 loc) · 3.14 KB
/
cmake.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: CMake
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
BUILD_TYPE: Release
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
# Set database credentials as environment variables
- name: Set database credentials as environment variables
run: |
echo "DB_IP=${{ secrets.DB_IP }}" >> $GITHUB_ENV
echo "DB_USER=${{ secrets.DB_USER }}" >> $GITHUB_ENV
echo "DB_PASS=${{ secrets.DB_PASS }}" >> $GITHUB_ENV
# NOTE: If a boost version matching all requirements cannot be found,
# this build step will fail
- name: Configure CMake
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}}
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
run: ctest -C build --verbose
build-mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
# Set database credentials as environment variables
- name: Set database credentials as environment variables
run: |
echo "DB_IP=${{ secrets.DB_IP }}" >> $GITHUB_ENV
echo "DB_USER=${{ secrets.DB_USER }}" >> $GITHUB_ENV
echo "DB_PASS=${{ secrets.DB_PASS }}" >> $GITHUB_ENV
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
run: ctest -C build --verbose
code-coverage:
# Exectute code coverage generation and upload to CodeCov.
# Issues with running the test executables resulted in using this step on linux.
runs-on: ubuntu-latest # Use a Linux runner
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install C++ compiler and dependencies
run: |
sudo apt-get update
sudo apt-get install -y g++
- name: Install gcovr
run: sudo apt-get install -y gcovr
- name: Compile and run tests
working-directory: ${{github.workspace}}/tests
run: |
ls -R
g++ --coverage test.cpp -o coverage1
g++ --coverage plannerTests.cpp -o coverage2
g++ --coverage recipeTests.cpp -o coverage3
g++ --coverage reviewTests.cpp -o coverage4
./coverage1
./coverage2
./coverage3
./coverage4
ls -R
gcovr -r ../ --xml --exclude catch_amalgamated.cpp --exclude catch_amalgamated.hpp -o coverage.xml
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ${{github.workspace}}/tests/coverage.xml