-
-
Notifications
You must be signed in to change notification settings - Fork 11
324 lines (294 loc) · 10.3 KB
/
ci.yml
File metadata and controls
324 lines (294 loc) · 10.3 KB
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
---
name: CI
permissions: {}
on:
pull_request:
push:
branches:
- master
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
setup_release:
name: Setup Release
outputs:
publish_release: ${{ steps.setup_release.outputs.publish_release }}
release_body: ${{ steps.setup_release.outputs.release_body }}
release_commit: ${{ steps.setup_release.outputs.release_commit }}
release_generate_release_notes: ${{ steps.setup_release.outputs.release_generate_release_notes }}
release_tag: ${{ steps.setup_release.outputs.release_tag }}
release_version: ${{ steps.setup_release.outputs.release_version }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Release
id: setup_release
uses: LizardByte/actions/actions/release_setup@4125866b7b655a6fe038b0e22a43a4c5d259af79 # v2026.417.35446
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build (${{ matrix.name }})
needs: setup_release
permissions:
contents: read
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.shell }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux
os: ubuntu-latest
shell: bash
- name: macOS
os: macos-latest
shell: bash
- name: Windows-AMD64
os: windows-latest
shell: msys2 {0}
msystem: ucrt64
toolchain: ucrt-x86_64
- name: Windows-ARM64
os: windows-11-arm
shell: msys2 {0}
msystem: clangarm64
toolchain: clang-aarch64
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
- name: Setup Dependencies Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
ninja-build \
nlohmann-json3-dev
- name: Setup Dependencies macOS
if: runner.os == 'macOS'
run: |
brew update
brew install \
boost \
cmake \
doxygen \
graphviz \
nlohmann-json \
ninja \
node \
- name: Setup Dependencies Windows
if: runner.os == 'Windows'
uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c # v2.31.1
with:
msystem: ${{ matrix.msystem }}
update: true
install: >-
doxygen
mingw-w64-${{ matrix.toolchain }}-boost
mingw-w64-${{ matrix.toolchain }}-cmake
mingw-w64-${{ matrix.toolchain }}-graphviz
mingw-w64-${{ matrix.toolchain }}-ninja
mingw-w64-${{ matrix.toolchain }}-nlohmann-json
mingw-w64-${{ matrix.toolchain }}-nodejs
mingw-w64-${{ matrix.toolchain }}-toolchain
- name: Setup python
id: setup-python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.14'
- name: Python Path
id: python-path
env:
TMP_PYTHON_PATH: ${{ steps.setup-python.outputs.python-path }}
run: |
if [ "${RUNNER_OS}" == "Windows" ]; then
# replace backslashes with double backslashes
python_path=$(echo "${TMP_PYTHON_PATH}" | sed 's/\\/\\\\/g')
else
python_path="${TMP_PYTHON_PATH}"
fi
# step output
echo "python-path=${python_path}"
echo "python-path=${python_path}" >> "${GITHUB_OUTPUT}"
- name: Build
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }}
COMMIT: ${{ needs.setup_release.outputs.release_commit }}
run: |
mkdir -p build
if [ "${RUNNER_OS}" = "Linux" ]; then
# Doxygen from Ubuntu is too old, need Doxygen >= 1.10
DOCS=OFF
else
DOCS=ON
fi
cmake \
-DBUILD_DOCS=${DOCS} \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-B build \
-G Ninja \
-S .
ninja -C build
- name: Run tests
id: test
working-directory: build/tests
run: ./test_libdisplaydevice --gtest_color=yes --gtest_output=xml:test_results.xml
- name: Generate gcov report
id: test_report
# any except canceled or skipped
if: >-
always() &&
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
env:
PYTHON_PATH: ${{ steps.python-path.outputs.python-path }}
working-directory: build
run: |
"${PYTHON_PATH}" -m pip install "../scripts[test]"
"${PYTHON_PATH}" -m gcovr . -r ../src \
--exclude-noncode-lines \
--exclude-throw-branches \
--exclude-unreachable-branches \
--verbose \
--xml-pretty \
-o coverage.xml
- name: Upload coverage artifact
if: >-
always() &&
(steps.test_report.outcome == 'success')
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-${{ matrix.name }}
path: |
build/coverage.xml
build/tests/test_results.xml
if-no-files-found: error
- name: Move Artifacts
run: |
mkdir -p artifacts
if [[ "${RUNNER_OS}" == "Windows" ]]; then
mv -f ./build/tests/test_libdisplaydevice.exe artifacts/
else
mv -f ./build/tests/test_libdisplaydevice artifacts/
fi
- name: Upload Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-${{ matrix.name }}
path: artifacts/
if-no-files-found: error
coverage:
name: Coverage-${{ matrix.flag }}
if: >-
always() &&
(needs.build.result == 'success' || needs.build.result == 'failure') &&
startsWith(github.repository, 'LizardByte/')
needs: build
permissions:
contents: read
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- build_name: Linux
flag: Linux
- build_name: macOS
flag: macOS
- build_name: Windows-AMD64
flag: Windows-AMD64
- build_name: Windows-ARM64
flag: Windows-ARM64
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download coverage artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: coverage-${{ matrix.build_name }}
path: _coverage
- name: Debug coverage file
run: cat _coverage/coverage.xml
- name: Upload test coverage
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
disable_search: true
fail_ci_if_error: true
files: ./_coverage/coverage.xml
report_type: coverage
flags: ${{ matrix.flag }}
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Upload test results
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
disable_search: true
fail_ci_if_error: true
files: ./_coverage/tests/test_results.xml
report_type: test_results
flags: ${{ matrix.flag }}
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
release:
name: Release
if:
always() &&
needs.setup_release.outputs.publish_release == 'true' &&
needs.build.result == 'success' &&
startsWith(github.repository, 'LizardByte/')
needs:
- build
- setup_release
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Download build artifact (Windows-AMD64)
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build-Windows-AMD64
path: build-Windows-AMD64
- name: Download build artifact (Windows-ARM64)
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build-Windows-ARM64
path: build-Windows-ARM64
- name: Download build artifact (Linux)
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build-Linux
path: build-Linux
- name: Download build artifact (macOS)
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build-macOS
path: build-macOS
- name: Move artifacts
run: |
mkdir -p artifacts
mv -f build-Windows-AMD64/test_libdisplaydevice.exe artifacts/test_libdisplaydevice-Windows-AMD64.exe
mv -f build-Windows-ARM64/test_libdisplaydevice.exe artifacts/test_libdisplaydevice-Windows-ARM64.exe
mv -f build-Linux/test_libdisplaydevice artifacts/test_libdisplaydevice-Linux
mv -f build-macOS/test_libdisplaydevice artifacts/test_libdisplaydevice-macOS
- name: Create/Update GitHub Release
if: needs.setup_release.outputs.publish_release == 'true'
uses: LizardByte/actions/actions/release_create@4125866b7b655a6fe038b0e22a43a4c5d259af79 # v2026.417.35446
with:
allowUpdates: false
body: ${{ needs.setup_release.outputs.release_body }}
draft: true
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
name: ${{ needs.setup_release.outputs.release_tag }}
prerelease: true
tag: ${{ needs.setup_release.outputs.release_tag }}
token: ${{ secrets.GH_BOT_TOKEN }}
virustotal_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }}