1
1
name : ci
2
2
on :
3
3
pull_request :
4
+ release :
5
+ types : [published]
6
+
4
7
push :
5
8
tags :
6
9
branches :
7
10
- main
11
+ - develop
8
12
9
13
env :
10
- # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11
- # Conan cache environment variables
12
- CONAN_SYSREQUIRES_MODE : enabled
13
- CONAN_USER_HOME : " ${{ github.workspace }}/conan-cache"
14
- CONAN_USER_HOME_SHORT : " ${{ github.workspace }}/conan-cache/short"
14
+ CLANG_TIDY_VERSION : " 15.0.2"
15
+ VERBOSE : 1
15
16
16
17
jobs :
17
18
Test :
@@ -32,116 +33,145 @@ jobs:
32
33
- macos-10.15
33
34
- windows-2019
34
35
compiler :
35
- # you can specify the version after `-` like "llvm-13 .0.0 ".
36
- - llvm
37
- - gcc-8
36
+ # you can specify the version after `-` like "llvm-15 .0.2 ".
37
+ - llvm-15.0.2
38
+ - gcc-11
38
39
generator :
39
40
- " Ninja Multi-Config"
40
41
build_type :
41
42
- Release
42
43
- Debug
43
- developer_mode :
44
+ package_maintainer_mode :
44
45
- ON
45
46
- OFF
46
- large_tests :
47
+ build_shared :
47
48
- OFF
48
49
49
50
exclude :
50
51
# mingw is determined by this author to be too buggy to support
51
52
- os : windows-2019
52
- compiler : gcc-8
53
- # These have anonalous failures, not sure what is up with no access to a physical Mac.
54
- - os : macos-10.15
55
- compiler : gcc-8
56
- build_type : Debug
57
- developer_mode : ON
53
+ compiler : gcc-11
54
+
55
+ include :
56
+ # Add appropriate variables for gcov version required. This will intentionally break
57
+ # if you try to use a compiler that does not have gcov set
58
+ - compiler : gcc-11
59
+ gcov_executable : gcov
60
+ enable_ipo : On
61
+
62
+ - compiler : llvm-15.0.2
63
+ enable_ipo : Off
64
+ gcov_executable : " llvm-cov gcov"
65
+
58
66
- os : macos-10.15
59
- compiler : llvm
60
- build_type : Release
61
- developer_mode : ON
67
+ enable_ipo : Off
68
+ enable_cppcheck : OFF
69
+ enable_clang_tidy : OFF
62
70
71
+ - os : ubuntu-20.04
72
+ enable_clang_tidy : On
73
+ enable_cppcheck : On
63
74
64
75
65
- include :
66
- # setup gcov variables for extra compiler versions
67
- - compiler : llvm
68
- gcov : " llvm-cov gcov"
69
- - compiler : gcc-8
70
- gcov : " gcov-8"
71
-
72
- # setup preferred package generators
73
- - developer_mode : OFF
74
- build_type : Release
76
+ # Set up preferred package generators, for given build configurations
77
+ - build_type : Release
78
+ package_maintainer_mode : OFF
75
79
package_generator : TBZ2
76
80
77
-
78
81
# This exists solely to make sure a non-multiconfig build works
79
82
- os : ubuntu-20.04
80
- compiler : gcc
81
- gcov : gcov
83
+ compiler : gcc-11
82
84
generator : " Unix Makefiles"
83
85
build_type : Debug
84
- developer_mode : On
86
+ gcov_executable : gcov
87
+ package_maintainer_mode : On
88
+ enable_ipo : Off
89
+ enable_clang_tidy : On
90
+ enable_cppcheck : On
85
91
86
- - os : windows-2019
92
+
93
+ # Windows msvc builds
94
+ - os : windows-2022
87
95
compiler : msvc
88
- generator : " Visual Studio 16 2019 "
96
+ generator : " Visual Studio 17 2022 "
89
97
build_type : Debug
90
- developer_mode : On
91
- - os : windows-2019
98
+ package_maintainer_mode : On
99
+ enable_ipo : On
100
+ enable_clang_tidy : Off
101
+ enable_cppcheck : Off
102
+
103
+
104
+ - os : windows-2022
92
105
compiler : msvc
93
- generator : " Visual Studio 16 2019 "
106
+ generator : " Visual Studio 17 2022 "
94
107
build_type : Release
95
- developer_mode : On
96
- - os : windows-2019
108
+ package_maintainer_mode : On
109
+ enable_ipo : On
110
+ enable_clang_tidy : Off
111
+ enable_cppcheck : Off
112
+
113
+
114
+ - os : windows-2022
97
115
compiler : msvc
98
- generator : " Visual Studio 16 2019 "
116
+ generator : " Visual Studio 17 2022 "
99
117
build_type : Debug
100
- developer_mode : Off
101
- - os : windows-2019
118
+ package_maintainer_mode : Off
119
+ enable_clang_tidy : Off
120
+ enable_cppcheck : Off
121
+
122
+
123
+ - os : windows-2022
102
124
compiler : msvc
103
- generator : " Visual Studio 16 2019 "
125
+ generator : " Visual Studio 17 2022 "
104
126
build_type : Release
105
- developer_mode : Off
127
+ package_maintainer_mode : Off
106
128
package_generator : ZIP
129
+ enable_clang_tidy : Off
130
+ enable_cppcheck : Off
107
131
108
132
133
+ - os : windows-2022
134
+ compiler : msvc
135
+ generator : " Visual Studio 17 2022"
136
+ build_type : Release
137
+ package_maintainer_mode : On
138
+ enable_ipo : On
139
+ build_shared : On
140
+ enable_clang_tidy : Off
141
+ enable_cppcheck : Off
109
142
110
143
111
144
112
145
steps :
146
+ - name : Check for llvm version mismatches
147
+ if : ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }}
148
+ uses : actions/github-script@v3
149
+ with :
150
+ script : |
151
+ core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen')
152
+
113
153
- uses : actions/checkout@v2
114
- - uses : actions/setup-python@v2
115
- - name : Cache
116
- uses : actions/cache@v2
154
+
155
+ - name : Setup Cache
156
+ uses : ./.github/ actions/setup_cache
117
157
with :
118
- path : |
119
- ~/vcpkg
120
- ./build/vcpkg_installed
121
- ${{ env.CONAN_USER_HOME }}
122
- ~/.cache/pip
123
- ${{ env.HOME }}/.cache/vcpkg/archives
124
- ${{ env.XDG_CACHE_HOME }}/vcpkg/archives
125
- ${{ env.LOCALAPPDATA }}\vcpkg\archives
126
- ${{ env.APPDATA }}\vcpkg\archives
127
- key : ${{ runner.os }}-${{ matrix.compiler }}-${{matrix.build_type}}-${{matrix.generator}}-${{matrix.developer_mode}}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./conanfile.txt')}}-${{ hashFiles('./vcpkg.json')}}
128
- restore-keys : |
129
- ${{ runner.os }}-${{ matrix.compiler }}-${{matrix.build_type}}-${{matrix.generator}}-${{matrix.developer_mode}}
130
-
131
- - run : pip3 install conan cmake ninja
158
+ compiler : ${{ matrix.compiler }}
159
+ build_type : ${{ matrix.build_type }}
160
+ package_maintainer_mode : ${{ matrix.package_maintainer_mode }}
161
+ generator : ${{ matrix.generator }}
132
162
133
163
- name : Setup Cpp
134
164
uses : aminya/setup-cpp@v1
135
165
with :
136
166
compiler : ${{ matrix.compiler }}
137
167
vcvarsall : ${{ contains(matrix.os, 'windows' )}}
138
168
139
- cmake : false
140
- ninja : false
141
- conan : false
169
+ cmake : true
170
+ ninja : true
142
171
vcpkg : false
143
172
ccache : true
144
- clangtidy : true
173
+ clangtidy : ${{ env.CLANG_TIDY_VERSION }}
174
+
145
175
146
176
cppcheck : true
147
177
@@ -150,7 +180,7 @@ jobs:
150
180
151
181
- name : Configure CMake
152
182
run : |
153
- cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING =${{matrix.build_type }} -DENABLE_DEVELOPER_MODE :BOOL=${{matrix.developer_mode }} -DENABLE_LARGE_TESTS: BOOL=${{matrix.large_tests }} -DOPT_ENABLE_COVERAGE :BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }}
183
+ cmake -S . -B ./build -G "${{matrix.generator}}" -Djson2cpp_ENABLE_CLANG_TIDY:BOOL =${{ matrix.enable_clang_tidy }} -Djson2cpp_ENABLE_CPPCHECK :BOOL=${{ matrix.enable_cppcheck }} -Djson2cpp_ENABLE_IPO=${{matrix.enable_ipo }} -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -Djson2cpp_PACKAGING_MAINTAINER_MODE: BOOL=${{matrix.package_maintainer_mode }} -Djson2cpp_ENABLE_COVERAGE :BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }}
154
184
155
185
- name : Build
156
186
# Execute the build. You can specify a specific target with "--target <NAME>"
@@ -164,19 +194,15 @@ jobs:
164
194
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
165
195
run : |
166
196
ctest -C ${{matrix.build_type}}
167
- pwd
168
- which gcov
169
- gcov --version
170
- gcovr --version
171
- gcovr -j ${{env.nproc}} --root ../ --print-summary --xml-pretty --xml coverage.xml . --verbose --gcov-executable '${{matrix.gcov}}'
197
+ gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}'
172
198
173
199
- name : Windows - Test and coverage
174
200
if : runner.os == 'Windows'
175
201
working-directory : ./build
176
202
run : |
177
203
OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{matrix.build_type}}
178
204
179
- - name : Build Package
205
+ - name : CPack
180
206
if : matrix.package_generator != ''
181
207
working-directory : ./build
182
208
run : |
@@ -190,13 +216,15 @@ jobs:
190
216
files : |
191
217
build/*-*${{ matrix.build_type }}*-*.*
192
218
219
+
193
220
- name : Publish Tagged Release
194
221
uses : softprops/action-gh-release@v1
195
222
if : ${{ startsWith(github.ref, 'refs/tags/') && matrix.package_generator != '' }}
196
223
with :
197
224
files : |
198
225
build/*-*${{ matrix.build_type }}*-*.*
199
226
227
+
200
228
- name : Publish to codecov
201
229
uses : codecov/codecov-action@v2
202
230
with :
0 commit comments