-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (122 loc) · 5.11 KB
/
ci.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: CI
on:
push:
branches: [main]
release:
types: [published]
pull_request:
workflow_dispatch:
jobs:
build:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- platform: linux
os: ubuntu-22.04
compiler: gcc-default
is_main: true
- platform: linux
os: ubuntu-22.04
compiler: gcc-latest
is_main: false
- platform: windows
os: windows-2022
compiler: msvc
is_main: true
env:
VCPKG_ROOT: vcpkg
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite
# Update when there is a new version of gcc available
LATEST_GCC_VERSION: 13
steps:
- uses: actions/checkout@v4
- name: Set up MSVC (Windows)
if: matrix.platform == 'windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Install dependencies (Linux)
if: matrix.platform == 'linux'
run: |
sudo apt update
sudo apt upgrade -y
sudo apt install --no-install-recommends build-essential ninja-build lcov
- name: Install latest gcc (Linux)
if: matrix.compiler == 'gcc-latest'
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-$LATEST_GCC_VERSION
# Use environment variable to tell CMake to compile with this version of gcc
echo CXX=g++-$LATEST_GCC_VERSION >> "$GITHUB_ENV"
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install VCPKG
run: |
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh -disableMetrics
- name: Configure HealthGPS (debug)
run: |
cmake --preset=${{ matrix.platform }}-debug -DWARNINGS_AS_ERRORS=ON -DGENERATE_COVERAGE=ON
- uses: ZedThree/[email protected]
if: matrix.compiler == 'gcc-default' && github.event_name == 'pull_request' && !(github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]')
id: review
with:
build_dir: out/build/linux-debug
config_file: .clang-tidy
lgtm_comment_body: ''
# Uploads an artefact containing clang_fixes.json
- uses: ZedThree/clang-tidy-review/[email protected]
if: matrix.compiler == 'gcc-default' && github.event_name == 'pull_request' && !(github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]')
id: upload-review
# If there are any comments, fail the check
- if: steps.review.outputs.total_comments > 0 && matrix.compiler == 'gcc-default' && !(github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]')
run: exit 1
- uses: ammaraskar/gcc-problem-matcher@master
- name: Build HealthGPS (debug)
if: '!cancelled()' # Run this step, even if the previous one fails
run: |
cmake --build --preset=debug-build-${{ matrix.platform }} --target=install
- name: Build HealthGPS (release)
if: '!cancelled()' # Run this step, even if the previous one fails
run: |
# Build documentation so we can show Doxygen warnings
cmake --preset=${{ matrix.platform }}-release -DWARNINGS_AS_ERRORS=ON -DBUILD_DOC=ON
cmake --build --preset=release-build-${{ matrix.platform }} --target=install
- name: Upload artifacts
if: matrix.is_main
uses: actions/upload-artifact@v4
with:
name: health-gps-${{ matrix.platform }}
path: |
${{ github.workspace }}/out/install/${{ matrix.platform }}-*/*
- name: Run tests
run: ctest --preset=core-test-${{ matrix.platform }}
- name: Generate coverage report
if: matrix.compiler == 'gcc-default'
working-directory: ${{github.workspace}}/out/build/${{ matrix.platform }}-debug
run: geninfo . --include 'src/HealthGPS*' --exclude 'src/HealthGPS.Tests' --output-file main_coverage.info
- name: Upload coverage reports to Codecov
if: matrix.compiler == 'gcc-default'
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Zip output folder
if: startsWith(github.ref, 'refs/tags/') && matrix.is_main
working-directory: ${{github.workspace}}/out/install/${{ matrix.platform }}-release/bin/
run: |
mkdir ${{github.workspace}}/artifact
7z a -tzip ${{github.workspace}}/artifact/health_gps_${{ matrix.platform }}.zip *.dll *.Console* schemas
- name: Upload release artifacts
if: startsWith(github.ref, 'refs/tags/') && matrix.is_main
uses: softprops/action-gh-release@v2
with:
files: artifact/health_gps_${{ matrix.platform }}.zip