-
-
Notifications
You must be signed in to change notification settings - Fork 53
355 lines (300 loc) · 10.4 KB
/
ci.yaml
File metadata and controls
355 lines (300 loc) · 10.4 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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
name: CI
# Controls when the action will run. Triggers the workflow on push or pull
# request events but only for the develop branch. Also allows manual trigger.
on:
push:
branches:
- develop
tags:
- 'v*'
pull_request:
branches: [ develop ]
workflow_dispatch:
jobs:
check-version:
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v6
- name: Check CMakeLists.txt VERSION matches git tag
run: |
CMAKE_VERSION=$(grep -oP 'project\s*\(\s*gerbv\s+VERSION\s+\K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt)
TAG_VERSION="${{ github.ref_name }}"
TAG_BASE="${TAG_VERSION#v}"
TAG_BASE="${TAG_BASE%%-*}"
if [ "$CMAKE_VERSION" != "$TAG_BASE" ]; then
echo "ERROR: CMakeLists.txt VERSION (${CMAKE_VERSION}) does not match git tag (${TAG_VERSION})"
echo "Please update VERSION in CMakeLists.txt before tagging a release."
exit 1
fi
echo "Version check passed: ${CMAKE_VERSION} matches tag ${TAG_VERSION}"
ci-ubuntu-22-04:
runs-on: ubuntu-22.04
strategy:
matrix:
coverage: [""] # Only regular build, no coverage
include:
- coverage: ""
code_coverage: "" # Always empty, so matrix.code_coverage is always false
steps:
- uses: actions/checkout@v6
- name: Get number of jobs for compiling
run: echo "NUM_BUILD_JOBS=$((`nproc --all` * 4))" >> $GITHUB_ENV
- name: Set a local install path
run: echo "LOCAL_INSTALL_PATH=${HOME}/.local" >> $GITHUB_ENV
- name: Get requirements for configure and build
run: |
sudo apt-get update
sudo apt-get install cmake libgtkmm-2.4-dev desktop-file-utils libc6-dbg imagemagick
- name: Install coverage specific programs
if: matrix.code_coverage
run: |
sudo apt-get install libperlio-gzip-perl libjson-perl
pushd ~
git clone --depth=1 --branch=v1.16 https://github.com/linux-test-project/lcov.git
pushd lcov
make PREFIX=${LOCAL_INSTALL_PATH} install
hash -r
lcov --version
- name: Install valgrind
if: matrix.code_coverage
run: |
pushd ~
git clone --depth=1 --branch=master https://github.com/eyal0/valgrind.git
pushd valgrind
sh autogen.sh
./configure --prefix=${LOCAL_INSTALL_PATH}
make -j ${NUM_BUILD_JOBS}
make install
popd
popd
- name: Configure
run: cmake --preset linux-gnu-gcc
- name: Remove debug and optimization and valgrind from coverage builds
if: matrix.code_coverage
run: |
find . -name Makefile | xargs sed -i 's/-O[0-9]/-O0/g' # No optimizations
find . -name Makefile | xargs sed -i 's/-g /-g0 /g' # No debugging
: > test/run_valgrind_tests.sh # No valgrind tests.
- name: Build
run: cmake --build build -j ${NUM_BUILD_JOBS}
- name: Run tests
if: "!matrix.code_coverage"
continue-on-error: true
run: ctest --preset linux-gnu-gcc -V
- name: Reset coverage
if: matrix.code_coverage
continue-on-error: true
run: lcov --directory . -z
- name: Run unit tests
if: matrix.code_coverage
run: cd test && ./run_tests.sh
- name: Gather coverage
if: matrix.code_coverage
run: |
lcov --rc lcov_branch_coverage=1 -rc lcov_function_coverage=1 --directory . --capture --no-external --output-file "gerbv-lcov.info"
- name: Upload coverage to coveralls
if: matrix.code_coverage
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: gerbv-lcov.info
ci-fedora:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Rebuild Fedora 43
run: npx --package mini-cross@0.15.2 mc --no-tty fedora_43 .mc/rebuild.sh
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: gerbv-fedora
path: gerbv.github.io/ci/
if-no-files-found: error
ci-ubuntu:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Rebuild Ubuntu 22.04
run: npx --package mini-cross@0.15.2 mc --no-tty ubuntu_22.04 .mc/rebuild.sh
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: gerbv-ubuntu
path: gerbv.github.io/ci/
if-no-files-found: error
ci-debian:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Rebuild Debian 13
run: npx --package mini-cross@0.15.2 mc --no-tty debian_13 .mc/rebuild.sh
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: gerbv-debian
path: gerbv.github.io/ci/
if-no-files-found: error
ci-windows_amd64-cross:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Rebuild Windows amd64 cross compilation
run: npx --package mini-cross@0.15.2 mc --no-tty windows_amd64 .mc/rebuild-win.sh
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: gerbv-windows_amd64
path: gerbv.github.io/ci/
if-no-files-found: error
ci-macos:
runs-on: macos-15
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get number of jobs for compiling
run: echo "NUM_BUILD_JOBS=$(sysctl -n hw.logicalcpu)" >> $GITHUB_ENV
- name: Install build dependencies
run: |
# These packages are already installed. We comment them out to avoid warnings
# brew install cmake ninja pkgconf libpng gettext
brew install gtk+ gtkmm libffi zlib bzip2 expat imagemagick
echo "PATH=$(brew --prefix gettext)/bin:${PATH}" >> $GITHUB_ENV
mkdir -p "${HOME}/.local/lib/pkgconfig"
BZIP_PREFIX="$(brew --prefix bzip2)"
BZIP_VERSION="$(brew list --versions bzip2 | awk '{print $2}')"
printf '%s\n' \
"prefix=${BZIP_PREFIX}" \
'exec_prefix=${prefix}' \
'libdir=${exec_prefix}/lib' \
'includedir=${prefix}/include' \
'' \
'Name: bzip2' \
'Description: bzip2 compression library' \
"Version: ${BZIP_VERSION}" \
'Libs: -L${libdir} -lbz2' \
'Cflags: -I${includedir}' \
> "${HOME}/.local/lib/pkgconfig/bzip2.pc"
echo "PKG_CONFIG_PATH=${HOME}/.local/lib/pkgconfig:$(brew --prefix libffi)/lib/pkgconfig:$(brew --prefix zlib)/lib/pkgconfig:$(brew --prefix bzip2)/lib/pkgconfig:$(brew --prefix libpng)/lib/pkgconfig:$(brew --prefix expat)/lib/pkgconfig:$(brew --prefix)/lib/pkgconfig:${PKG_CONFIG_PATH}" >> $GITHUB_ENV
- name: Configure
run: cmake --preset macos-clang
- name: Build
run: cmake --build --preset macos-clang --parallel ${NUM_BUILD_JOBS}
- name: Run tests
continue-on-error: true
run: ctest --preset macos-clang -V
- name: Package
run: bash .mc/package-macos.sh
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: gerbv-macos
path: gerbv.github.io/ci/
if-no-files-found: error
ci-windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: git zip
pacboy: >-
toolchain:p
cmake:p
ninja:p
pkgconf:p
gtk2:p
gtkmm:p
gettext-tools:p
imagemagick:p
- name: Configure
run: cmake --preset msys2-ucrt64-gcc
- name: Build
run: cmake --build --preset msys2-ucrt64-gcc --parallel $(nproc)
- name: Run tests
continue-on-error: true
run: ctest --preset msys2-ucrt64-gcc -V
- name: Package
run: bash .mc/package-msys2.sh
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: gerbv-windows-msys2
path: gerbv.github.io/ci/
if-no-files-found: error
ci-website:
runs-on: ubuntu-22.04
needs: [ci-fedora, ci-debian, ci-ubuntu, ci-windows_amd64-cross, ci-macos, ci-windows]
if: ${{ github.ref == 'refs/heads/develop' && github.event_name == 'push' }}
steps:
- uses: actions/checkout@v6
- name: Download all platform artifacts
uses: actions/download-artifact@v6
with:
pattern: gerbv-*
path: gerbv.github.io/ci/
merge-multiple: true
- name: Install doxygen
run: |
sudo apt-get update
sudo apt-get install doxygen
- name: Build website
run: make -C gerbv.github.io
- name: Deploy gerbv.github.io
uses: JamesIves/github-pages-deploy-action@v4
with:
repository-name: gerbv/gerbv.github.io
branch: gh-pages
folder: gerbv.github.io
ssh-key: ${{ secrets.PAGES_DEPLOY_KEY }}
git-config-name: gerbv-buildbot
git-config-email: gerbv-buildbot@users.noreply.github.com
single-commit: true
env:
PAGES_DEPLOY_KEY: ${{ secrets.PAGES_DEPLOY_KEY }}
# Guard: step is skipped (not failed) when deploy key secret is absent
if: ${{ env.PAGES_DEPLOY_KEY != '' }}
release:
runs-on: ubuntu-22.04
needs: [check-version, ci-ubuntu-22-04, ci-fedora, ci-debian, ci-ubuntu, ci-windows_amd64-cross, ci-macos, ci-windows]
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v6
with:
pattern: gerbv-*
path: artifacts/
merge-multiple: true
- name: Rename artifacts to use version tag
run: |
cd artifacts
for f in gerbv_*; do
os_part=$(echo "$f" | sed 's/gerbv_[0-9-]*_[a-f0-9]*_//')
mv "$f" "gerbv_${{ github.ref_name }}_${os_part}"
done
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**
draft: true
prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-alpha') || contains(github.ref_name, '-beta') }}
generate_release_notes: true