-
Notifications
You must be signed in to change notification settings - Fork 333
274 lines (236 loc) · 9.38 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
name: Continuous Integration
on:
push:
branches:
- '*'
tags:
- "v*.*.*"
pull_request:
branches:
- develop
concurrency:
group: ${{format('{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true
jobs:
cpp-matrix:
runs-on: ubuntu-latest
name: Generate Test Matrix
outputs:
matrix: ${{ steps.cpp-matrix.outputs.matrix }}
steps:
- name: Generate Test Matrix
uses: alandefreitas/cpp-actions/[email protected]
id: cpp-matrix
with:
compilers: |
gcc >=7
clang 6 || 9 || 12 || >=14
msvc >= 14
mingw *
clang-cl *
apple-clang *
standards: '>=17'
latest-factors: gcc Coverage UBSan
max-standards: 1
build:
needs: cpp-matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.cpp-matrix.outputs.matrix) }}
defaults:
run:
shell: bash
name: ${{ matrix.name }}
runs-on: ${{ matrix.runs-on }}
container: ${{ matrix.container }}
permissions:
contents: write
steps:
- name: Clone matplot++
uses: actions/checkout@v3
- name: Setup C++
uses: alandefreitas/cpp-actions/[email protected]
id: setup-cpp
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
- name: Install packages
uses: alandefreitas/cpp-actions/[email protected]
id: package-install
with:
apt-get: ${{ matrix.install }} ${{ ((matrix.coverage) && 'gnuplot') || '' }}
- name: CMake Workflow
uses: alandefreitas/cpp-actions/[email protected]
with:
cmake-version: '>=3.15'
generator: ${{ matrix.generator }}
build-type: ${{ matrix.build-type }}
# Only run tests in these two cases because we're just running examples here.
# Other tests come later.
run-tests: ${{ ((matrix.coverage) && 'true') || '' }}
cxxstd: ${{ (!matrix.coverage && matrix.cxxstd) || matrix.latest-cxxstd }}
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
ccflags: ${{ matrix.ccflags }}
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
cxxflags: ${{ matrix.cxxflags }}
# Also make it shared in coverage tests because of disk space
shared: ${{ matrix.shared || matrix.coverage }}
install-prefix: $GITHUB_WORKSPACE/.local
export-compile-commands: ${{ matrix.time-trace }}
# There are cases where the environment cannot store all examples, and we need to disable them
extra-args: -D MATPLOTPP_BUILD_WITH_PEDANTIC_WARNINGS=ON ${{ format('-D MATPLOTPP_BUILD_EXAMPLES={0}', (!matrix.asan && !matrix.ubsan && !matrix.x86 && 'ON') || 'OFF' ) }}
package: ${{ matrix.is-main }}
package-artifact: false
package-dir: packages
- name: Archive packages
if: ${{ matrix.is-main && github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
uses: actions/upload-artifact@v3
with:
name: release-packages-${{ matrix.compiler }}${{ (!contains('*', matrix.version) && format('-{0}', matrix.version)) || '' }}-${{ runner.os }}
path: build/packages
retention-days: 1
- name: CMake Integration
uses: alandefreitas/cpp-actions/[email protected]
if: ${{ !matrix.ubsan && !matrix.asan }}
with:
source-dir: test/integration
ref-source-dir: ./test/integration
cmake-version: '>=3.15'
generator: ${{ matrix.generator }}
build-type: ${{ matrix.build-type }}
run-tests: ''
cxxstd: ${{ matrix.cxxstd }}
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
ccflags: ${{ matrix.ccflags }}
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
cxxflags: ${{ matrix.cxxflags }}
shared: ${{ matrix.shared || matrix.coverage }}
install: false
extra-args: ${{ format('-D Matplot++_ROOT="{0}"', '$GITHUB_WORKSPACE/.local') }}
export-compile-commands: ${{ matrix.time-trace }}
- name: FlameGraph
uses: alandefreitas/cpp-actions/[email protected]
if: matrix.time-trace
with:
build-dir: build
github_token: ${{ secrets.GITHUB_TOKEN }}
trace-commands: true
- name: Codecov
if: ${{ matrix.coverage }}
run: |
set -x
# Find gcov
gcov_tool="gcov"
if command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}.${{ steps.setup-cpp.outputs.version-minor }}" &> /dev/null; then
gcov_tool="gcov"
elif command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}" &> /dev/null; then
gcov_tool="gcov-${{ steps.setup-cpp.outputs.version-major }}"
fi
lcov -c -q -o "./build/coverage.info" -d "./build" --include "$(pwd)/*" --gcov-tool "$gcov_tool"
# Upload to codecov
bash <(curl -s https://codecov.io/bash) -f "./build/coverage.info"
# Update summary
echo "# Coverage" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
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
echo "" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
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
echo "" >> $GITHUB_STEP_SUMMARY
docs:
needs: build
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
defaults:
run:
shell: bash
name: Publish docs
# timeout-minutes: 120
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Clone matplot++
uses: actions/checkout@v3
- name: Generate Table of Contents
uses: technote-space/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAX_HEADER_LEVEL: 3
FOLDING: true
- name: Update Contributors
uses: akhilmhdh/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
image_size: 100
columns_per_row: 6
- name: Download mdsplit
uses: carlosperate/[email protected]
id: download-mdsplit
with:
file-url: 'https://github.com/alandefreitas/mdsplit/releases/download/v0.1.1/Executable.Linux.zip'
file-name: 'mdsplit.zip'
location: '.'
- name: Unzip mdsplit
run: |
unzip mdsplit.zip
rm -f mdsplit.zip
sudo chmod +x mdsplit
ls
- name: Generate Documentation Source
run: ./mdsplit -r alandefreitas/matplotplusplus
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install Mkdocs Material
run: pip install mkdocs-material
- name: Install Awesome Pages Plugin # https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin
run: pip install mkdocs-awesome-pages-plugin
- name: Deploy mkdocs to gh-pages branch
run: mkdocs gh-deploy --force
releases:
needs: build
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
defaults:
run:
shell: bash
name: Create Release Packages
timeout-minutes: 120
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Clone matplot++
uses: actions/checkout@v3
- name: Check conventional commit
if: ${{ !contains( matrix.config.os, 'macos') }}
uses: webiny/[email protected]
continue-on-error: true
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: List artifacts
run: ls -R
working-directory: artifacts
- name: Create changelog
uses: alandefreitas/cpp-actions/create-changelog@4f2622267261fc75a0d885cf3367f29e62984f68 # v1.5.0
with:
output-path: CHANGELOG.md
thank-non-regular: ${{ startsWith(github.ref, 'refs/tags/') }}
github-token: ${{ secrets.GITHUB_TOKEN }}
link-commits: ${{ ! (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) }}
limit: 150
- name: Create GitHub Package Release
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v1
with:
files: artifacts/release-packages-*/*
name: ${{ github.ref_name || github.ref }}
tag_name: ${{ github.ref_name || github.ref }}${{ ((!startsWith(github.ref, 'refs/tags/')) && '-release') || '' }}
body_path: CHANGELOG.md
prerelease: false
draft: false
token: ${{ github.token }}