Skip to content

Commit 7ebe6a0

Browse files
committed
ci: update cpp-actions to v1.4.0
1 parent 8205c99 commit 7ebe6a0

File tree

1 file changed

+99
-38
lines changed

1 file changed

+99
-38
lines changed

.github/workflows/ci.yml

+99-38
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,54 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
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+
2144
build:
45+
needs: cpp-matrix
46+
2247
strategy:
2348
fail-fast: false
2449
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
2955

3056
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 }}
3359
permissions:
3460
contents: write
3561

3662
steps:
37-
- uses: actions/checkout@v3
63+
- name: Clone mrdox
64+
uses: actions/checkout@v3
3865

3966
- name: Install LLVM
4067
id: llvm-install
41-
if: ${{ startsWith( matrix.os , 'windows' ) }}
68+
if: ${{ startsWith( matrix.runs-on , 'windows' ) }}
4269
shell: bash
4370
run: |
4471
set -xe
@@ -53,7 +80,7 @@ jobs:
5380
find "$llvm_dir" -type f
5481
5582
- name: Setup C++
56-
uses: alandefreitas/cpp-actions/setup-cpp@v1.2.1
83+
uses: alandefreitas/cpp-actions/setup-cpp@v1.4.0
5784
id: setup-cpp
5885
with:
5986
compiler: ${{ matrix.compiler }}
@@ -62,39 +89,75 @@ jobs:
6289
check-latest: ${{ matrix.compiler == 'clang' }}
6390

6491
- name: Install packages
65-
uses: alandefreitas/cpp-actions/package-install@v1.3.0
92+
uses: alandefreitas/cpp-actions/package-install@v1.4.0
6693
id: package-install
6794
with:
68-
apt-get: ${{ matrix.install }}
95+
apt-get: ${{ matrix.install }} openjdk-11-jdk ninja-build
6996
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 }}
72101

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
75104
with:
76105
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 }}
82106
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') || '' }}
83114
install-prefix: .local
84115
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
89119

90120
- 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/')) }}
92122
uses: actions/upload-artifact@v3
93123
with:
94124
name: release-packages-${{ runner.os }}
95-
path: build/MrDox-?.?.?-*.*
125+
path: build/packages
96126
retention-days: 1
97127

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 "[![codecov](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA/graphs/sunburst.svg)](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: [![codecov](https://codecov.io/github/$GITHUB_REPOSITORY/branch/$GITHUB_REF_NAME/graph/badge.svg)](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY
159+
echo "" >> $GITHUB_STEP_SUMMARY
160+
98161
docs:
99162
needs: build
100163
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
@@ -109,21 +172,18 @@ jobs:
109172
contents: write
110173

111174
steps:
112-
- uses: actions/checkout@v3
175+
- name: Clone mrdox
176+
uses: actions/checkout@v3
113177

114178
- name: Install Node.js
115179
uses: actions/setup-node@v3
116180
with:
117181
node-version: '18'
118182

119-
- name: Install Antora
120-
working-directory: docs
121-
run: |
122-
npm install
123-
124183
- name: Generate Site
125184
working-directory: docs
126185
run: |
186+
npm install
127187
master_antora_exists=$(curl --silent --fail --head https://github.com/cppalliance/mrdox/blob/master/docs/antora.yml >/dev/null && echo "true" || echo "false")
128188
develop_antora_exists=$(curl --silent --fail --head https://github.com/cppalliance/mrdox/blob/develop/docs/antora.yml >/dev/null && echo "true" || echo "false")
129189
if [ "$master_antora_exists" == "true" ] && [ "$develop_antora_exists" == "true" ]; then
@@ -156,9 +216,8 @@ jobs:
156216
contents: write
157217

158218
steps:
159-
- uses: actions/checkout@v3
160-
with:
161-
fetch-depth: 100
219+
- name: Clone mrdox
220+
uses: actions/checkout@v3
162221

163222
- uses: actions/download-artifact@v3
164223
with:
@@ -174,11 +233,13 @@ jobs:
174233
run: ls -R
175234
working-directory: build
176235

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
179238
with:
180239
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
182243

183244
- name: Remove branch release
184245
if: ${{ github.event_name == 'push' && contains(fromJSON('["master", "develop"]'), github.ref_name) }}

0 commit comments

Comments
 (0)