-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (148 loc) · 5 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: ci
on:
pull_request:
release:
types: [published]
push:
tags: "*"
branches:
- main
- develop
workflow_dispatch:
jobs:
Test:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ${{ matrix.os }}
permissions:
actions: read
contents: write
security-events: write
strategy:
fail-fast: false
# Recommendations:
# * support at least 2 operating systems
# * support at least 2 compilers
# * make sure all supported configurations for your project are built
#
# Disable/enable builds in this list to meet the above recommendations
# and your own projects needs
matrix:
os:
- ubuntu-22.04
- macos-12
- windows-2022
compiler:
# you can specify the version after `-` like "llvm-13.0.0".
- llvm
- gcc-13
- msvc
build_type:
- Debug
- Release
developer_mode:
- ON
- OFF
# To exclude a specific job from the matrix (e.g gcc on Windows), you can use this syntax.
exclude:
- os: ubuntu-22.04
compiler: msvc
- os: macos-12
compiler: msvc
# FIXME: Solve annotated_string mismatch in Windows to enable developer mode totally
- os: windows-2022
compiler: msvc
developer_mode: ON
- os: windows-2022
compiler: gcc-13
developer_mode: ON
include:
# Inject gcov_executable variable
- compiler: llvm
gcov_executable: "llvm-cov gcov"
- compiler: gcc-13
gcov_executable: gcov-13
# Inject actual compiler name
- compiler: llvm
compiler_name: clang
- compiler: gcc-13
compiler_name: gcc
- compiler: msvc
compiler_name: msvc
# Enable package for release build
- build_type: Release
developer_mode: OFF
package_generator: ZIP
steps:
- name: Linux - Maximize build disk space
uses: easimon/maximize-build-space@v10
if: runner.os == 'Linux'
with:
root-reserve-mb: 30720
swap-size-mb: 1024
remove-android: "true"
remove-docker-images: "true"
remove-dotnet: "true"
- uses: actions/checkout@v4
- name: Setup cache
uses: ./.github/actions/setup_cache
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
developer_mode: ${{ matrix.developer_mode }}
- name: Setup cpp
uses: aminya/[email protected]
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows')}}
cmake: true
ninja: true
ccache: true
python: true
cppcheck: true
clangtidy: true
gcovr: true
opencppcoverage: true
- name: Setup conan
uses: ./.github/actions/setup_conan
id: conan
with:
os: ${{ matrix.os }}
arch: x86_64
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
- name: Configure cmake
run: |
cmake --preset ${{ matrix.compiler_name }} ${{ matrix.compiler_name == 'msvc' && '-A x64 -T v143' || '' }} -D ENABLE_DEVELOPER_MODE:BOOL=${{ matrix.developer_mode }} -D OPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }}
- name: Build and test
run: |
conan build . ${{ steps.conan.outputs.args }}
- name: Unix - Coverage
if: runner.os != 'Windows'
working-directory: build/${{ matrix.compiler_name }}
run: |
ctest -C ${{ matrix.build_type }}
gcovr -j ${{ env.nproc }} --delete --root ../../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}'
- name: Windows - Coverage
if: runner.os == 'Windows'
working-directory: build/${{ matrix.compiler_name }}
run: |
OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{ matrix.build_type }}
- name: Publish to codecov
uses: codecov/[email protected]
with:
files: ./build/${{ matrix.compiler_name }}/coverage.xml
flags: ${{ runner.os }}
name: ${{ runner.os }}-coverage
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: CPack
if: matrix.package_generator != ''
working-directory: build/${{ matrix.compiler_name }}
run: |
cpack -C ${{ matrix.build_type }} -G ${{ matrix.package_generator }} -B _package -V
- name: Publish tagged
uses: softprops/[email protected]
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.package_generator != '' }}
with:
files: |
build/${{ matrix.compiler_name }}/_package/*.*