@@ -18,27 +18,54 @@ concurrency:
18
18
cancel-in-progress : true
19
19
20
20
jobs :
21
+ cpp-matrix :
22
+ runs-on : ubuntu-latest
23
+ name : Generate Test Matrix
24
+ outputs :
25
+ matrix : ${{ steps.cpp-matrix.outputs.matrix }}
26
+ steps :
27
+ - name : Clone cpp-actions
28
+ uses : actions/checkout@v3
29
+
30
+ - name : Generate Test Matrix
31
+ uses : alandefreitas/cpp-actions/cpp-matrix@v1.4.0
32
+ id : cpp-matrix
33
+ with :
34
+ compilers : |
35
+ gcc 13
36
+ clang 16
37
+ msvc 14.34
38
+ standards : ' >=20'
39
+ max-standards : 1
40
+ latest-factors : gcc Coverage TSan UBSan
41
+ factors : | # Don't include Asan because `clang/AST/Decl.h` fails
42
+ clang Time-Trace
43
+
21
44
build :
45
+ needs : cpp-matrix
46
+
22
47
strategy :
23
48
fail-fast : false
24
49
matrix :
25
- include :
26
- - { name: "MSVC 14.3 - C++20", os: windows-2022, std: '20', cmake_args: -G "Visual Studio 17 2022" -A x64, github_release: true }
27
- - { name: "GCC 13 - C++20", os: ubuntu-22.04, compiler: gcc, version: 13.1, std: '20', github_release: true, install: "openjdk-11-jdk ninja-build" }
28
- - { name: "Clang 16 - C++20", os: ubuntu-22.04, compiler: clang, version: 16, std: 20, install: "openjdk-11-jdk ninja-build" }
50
+ include : ${{ fromJSON(needs.cpp-matrix.outputs.matrix) }}
51
+
52
+ defaults :
53
+ run :
54
+ shell : bash
29
55
30
56
name : ${{ matrix.name }}
31
- runs-on : ${{ matrix.os }}
32
- container : ${{ !startsWith( matrix.os , 'windows' ) && 'cppalliance/droneubuntu2204:llvm-731264b' || null }}
57
+ runs-on : ${{ matrix.runs-on }}
58
+ container : ${{ ( !startsWith( matrix.runs-on , 'windows' ) && 'cppalliance/droneubuntu2204:llvm-731264b' ) || null }}
33
59
permissions :
34
60
contents : write
35
61
36
62
steps :
37
- - uses : actions/checkout@v3
63
+ - name : Clone mrdox
64
+ uses : actions/checkout@v3
38
65
39
66
- name : Install LLVM
40
67
id : llvm-install
41
- if : ${{ startsWith( matrix.os , 'windows' ) }}
68
+ if : ${{ startsWith( matrix.runs-on , 'windows' ) }}
42
69
shell : bash
43
70
run : |
44
71
set -xe
53
80
find "$llvm_dir" -type f
54
81
55
82
- name : Setup C++
56
- uses : alandefreitas/cpp-actions/setup-cpp@v1.2.1
83
+ uses : alandefreitas/cpp-actions/setup-cpp@v1.4.0
57
84
id : setup-cpp
58
85
with :
59
86
compiler : ${{ matrix.compiler }}
@@ -62,39 +89,75 @@ jobs:
62
89
check-latest : ${{ matrix.compiler == 'clang' }}
63
90
64
91
- name : Install packages
65
- uses : alandefreitas/cpp-actions/package-install@v1.3 .0
92
+ uses : alandefreitas/cpp-actions/package-install@v1.4 .0
66
93
id : package-install
67
94
with :
68
- apt-get : ${{ matrix.install }}
95
+ apt-get : ${{ matrix.install }} openjdk-11-jdk ninja-build
69
96
vcpkg : fmt libxml2[tools]
70
- cxx : ${{ steps.setup-cpp.outputs.cxx }}
71
- cc : ${{ steps.setup-cpp.outputs.cc }}
97
+ cc : ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
98
+ ccflags : ${{ matrix.ccflags }}
99
+ cxx : ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
100
+ cxxflags : ${{ matrix.cxxflags }}
72
101
73
- - name : CMake Workflow (C++${{ matrix.std }})
74
- uses : alandefreitas/cpp-actions/cmake-workflow@v1.3 .0
102
+ - name : CMake Workflow
103
+ uses : alandefreitas/cpp-actions/cmake-workflow@v1.4 .0
75
104
with :
76
105
cmake-version : ' >=3.20'
77
- cxxstd : ${{ matrix.std }}
78
- cxx : ${{ steps.setup-cpp.outputs.cxx }}
79
- cc : ${{ steps.setup-cpp.outputs.cc }}
80
- cxxflags : ${{ ( matrix.compiler == 'gcc' && '-static-libstdc++') || '' }}
81
- toolchain : ${{ steps.package-install.outputs.vcpkg-toolchain }}
82
106
generator : Ninja
107
+ toolchain : ${{ steps.package-install.outputs.vcpkg-toolchain }}
108
+ build-type : ${{ matrix.build-type }}
109
+ cxxstd : ${{ matrix.cxxstd }}
110
+ cc : ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
111
+ ccflags : ${{ matrix.ccflags }}
112
+ cxx : ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
113
+ cxxflags : ${{ matrix.cxxflags }}${{ ( matrix.compiler == 'gcc' && ' -static-libstdc++') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
83
114
install-prefix : .local
84
115
extra-args : ${{ format('-D LLVM_ROOT="{0}" -D Clang_ROOT="{0}" -D CMAKE_EXPORT_COMPILE_COMMANDS=ON', steps.llvm-install.outputs.llvm-dir || '/usr/local') }}
85
-
86
- - name : Create packages
87
- working-directory : ./build
88
- run : cpack
116
+ export-compile-commands : ${{ matrix.time-trace }}
117
+ package : ${{ matrix.is-main }}
118
+ package-dir : packages
89
119
90
120
- name : Upload GitHub Release Artifacts
91
- if : ${{ matrix.github_release && github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
121
+ if : ${{ matrix.is-main && github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
92
122
uses : actions/upload-artifact@v3
93
123
with :
94
124
name : release-packages-${{ runner.os }}
95
- path : build/MrDox-?.?.?-*.*
125
+ path : build/packages
96
126
retention-days : 1
97
127
128
+ - name : FlameGraph
129
+ uses : alandefreitas/cpp-actions/flamegraph@v1.4.0
130
+ if : matrix.time-trace
131
+ with :
132
+ build-dir : build
133
+ github_token : ${{ secrets.GITHUB_TOKEN }}
134
+ trace-commands : true
135
+
136
+ - name : Codecov
137
+ if : ${{ matrix.coverage }}
138
+ run : |
139
+ set -x
140
+ # Find gcov
141
+ gcov_tool="gcov"
142
+ if command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}.${{ steps.setup-cpp.outputs.version-minor }}" &> /dev/null; then
143
+ gcov_tool="gcov"
144
+ elif command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}" &> /dev/null; then
145
+ gcov_tool="gcov-${{ steps.setup-cpp.outputs.version-major }}"
146
+ fi
147
+ lcov -c -q -o "./build/coverage.info" -d "./build" --include "$(pwd)/*" --gcov-tool "$gcov_tool"
148
+
149
+ # Upload to codecov
150
+ bash <(curl -s https://codecov.io/bash) -f "./build/coverage.info"
151
+
152
+ # Update summary
153
+ echo "# Coverage" >> $GITHUB_STEP_SUMMARY
154
+ echo "" >> $GITHUB_STEP_SUMMARY
155
+ echo "[](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY
156
+ echo "" >> $GITHUB_STEP_SUMMARY
157
+ echo "" >> $GITHUB_STEP_SUMMARY
158
+ echo "$GITHUB_REF_NAME: [](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY
159
+ echo "" >> $GITHUB_STEP_SUMMARY
160
+
98
161
docs :
99
162
needs : build
100
163
if : ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
@@ -109,21 +172,18 @@ jobs:
109
172
contents : write
110
173
111
174
steps :
112
- - uses : actions/checkout@v3
175
+ - name : Clone mrdox
176
+ uses : actions/checkout@v3
113
177
114
178
- name : Install Node.js
115
179
uses : actions/setup-node@v3
116
180
with :
117
181
node-version : ' 18'
118
182
119
- - name : Install Antora
120
- working-directory : docs
121
- run : |
122
- npm install
123
-
124
183
- name : Generate Site
125
184
working-directory : docs
126
185
run : |
186
+ npm install
127
187
master_antora_exists=$(curl --silent --fail --head https://github.com/cppalliance/mrdox/blob/master/docs/antora.yml >/dev/null && echo "true" || echo "false")
128
188
develop_antora_exists=$(curl --silent --fail --head https://github.com/cppalliance/mrdox/blob/develop/docs/antora.yml >/dev/null && echo "true" || echo "false")
129
189
if [ "$master_antora_exists" == "true" ] && [ "$develop_antora_exists" == "true" ]; then
@@ -156,9 +216,8 @@ jobs:
156
216
contents : write
157
217
158
218
steps :
159
- - uses : actions/checkout@v3
160
- with :
161
- fetch-depth : 100
219
+ - name : Clone mrdox
220
+ uses : actions/checkout@v3
162
221
163
222
- uses : actions/download-artifact@v3
164
223
with :
@@ -174,11 +233,13 @@ jobs:
174
233
run : ls -R
175
234
working-directory : build
176
235
177
- - name : Create release notes
178
- uses : alandefreitas/cpp-actions/create-changelog@v1.0 .0
236
+ - name : Create changelog
237
+ uses : alandefreitas/cpp-actions/create-changelog@v1.4 .0
179
238
with :
180
239
output-path : CHANGELOG.md
181
- limit : 50
240
+ thank-non-regular : ${{ startsWith(github.ref, 'refs/tags/') }}
241
+ github-token : ${{ secrets.GITHUB_TOKEN }}
242
+ limit : 150
182
243
183
244
- name : Remove branch release
184
245
if : ${{ github.event_name == 'push' && contains(fromJSON('["master", "develop"]'), github.ref_name) }}
0 commit comments