-
Notifications
You must be signed in to change notification settings - Fork 1
553 lines (522 loc) · 16 KB
/
build.yaml
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
---
name: build
#######################################
# GITHUB WORKFLOW BAD LOG
#
# Cannot check cache hit, the actions/cache always extract the cache
# No wait to share cache between branches
# Cannot depend on matrix instance
# Matrix instance cannot depend
# Cannot matrix when calling workflows
# No way to reuse matrix
# Cannot call nested workflows
# Cannot run workflow from a step
# No way for a step to call step
on:
pull_request:
push:
env:
caches_version: v1
jobs:
#############################################################################################################
# CACHES
#############################################################################################################
C-openssl-binaries:
name: ${{ matrix.version}}-${{ matrix.os }}@C-openssl-binaries
runs-on: ubuntu-latest
strategy:
matrix:
include:
- version: "1.1.1"
os: windows
dependencies: mingw-w64
branch: OpenSSL_1_1_1-stable
cross-compile-prefix: x86_64-w64-mingw32-
target: mingw64
- version: "3.0.7"
os: linux
dependencies:
branch: openssl-3.0.7
cross-compile-prefix:
target:
- version: "3.0"
os: linux
dependencies:
branch: openssl-3.0
cross-compile-prefix:
target:
- version: "3.0"
os: windows
dependencies: mingw-w64
branch: openssl-3.0
cross-compile-prefix: x86_64-w64-mingw32-
target: mingw64
- version: "3.1"
os: linux
dependencies:
branch: openssl-3.1
cross-compile-prefix:
target:
- version: "3.1"
os: windows
dependencies: mingw-w64
branch: openssl-3.1
cross-compile-prefix: x86_64-w64-mingw32-
target: mingw64
env:
openssl_name: openssl-${{ matrix.version }}-binaries-${{ matrix.os }}
steps:
- name: cache
id: cache
uses: actions/cache@v4
with:
path: ${{ env.openssl_name }}
key: ${{ env.openssl_name }}-${{ env.caches_version }}
- name: dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
sudo apt update
sudo apt install -y \
build-essential \
${{ matrix.dependencies }}
- name: checkout
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: openssl/openssl
ref: ${{ matrix.branch }}
path: openssl
- name: build
if: steps.cache.outputs.cache-hit != 'true'
working-directory: openssl
run: |
./Configure \
--prefix="${GITHUB_WORKSPACE}/${{ env.openssl_name }}" \
--libdir=lib \
--cross-compile-prefix=${{ matrix.cross-compile-prefix }} \
${{ matrix.target }}
make install_dev
#############################################################################################################
# SOURCES
#############################################################################################################
B-P-mycms-dist:
name: B-P-mycms-dist
runs-on: ubuntu-latest
steps:
- name: dependencies
run: |
sudo apt update
sudo apt install -y \
autoconf \
automake \
autotools-dev \
easy-rsa \
libssl-dev \
libtool \
pkg-config \
softhsm
- name: mycms-checkout
uses: actions/checkout@v4
with:
path: mycms
- name: mycms-prepare
run: |
mkdir -p mycms-build/distcheck
- name: mycms-generate
working-directory: mycms
run: |
autoreconf -ivf
- name: mycms-distcheck
working-directory: mycms-build/distcheck
run: |
"${GITHUB_WORKSPACE}/mycms/configure"
make distcheck
- name: mycms-dist-misc
run: |
tar -C mycms -czf mycms-packaging.tar.gz --transform 's#^[^/]*#mycms-packaging#' packaging
- name: mycms-dist-upload
uses: actions/upload-artifact@v4
with:
name: mycms-dist
path: |
mycms-build/distcheck/mycms-*.bz2
- name: mycms-misc-upload
uses: actions/upload-artifact@v4
with:
name: mycms-misc
path: |
mycms-packaging.tar.gz
- name: logs-upload
if: always()
uses: actions/upload-artifact@v4
with:
name: logs.${{ github.jobs[github.job].name }}
path: |
**/*.log
#############################################################################################################
# BUILD
#############################################################################################################
B-generic:
name: ${{ matrix.os }}-${{ matrix.crypto }} (V=${{ matrix.valgrind }})@B-generic
needs:
- B-P-mycms-dist
- C-openssl-binaries
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- windows
- linux
valgrind:
- 0
- 1
crypto:
- openssl-1.1.1
- openssl-3.0.7
- openssl-3.0
- openssl-3.1
exclude:
- os: windows
valgrind: 1
- os: windows
crypto: openssl-3.0.7
env:
crypto_name: ${{ matrix.crypto }}-binaries-${{ matrix.os }}
mycms_name: mycms-binaries-${{ matrix.os }}-${{ matrix.crypto }}
steps:
- name: env
run: |
export MYCMS_DO_VALGRIND=0
export MYCMS_COPY=
export MYCMS_DEPS=
export MYCMS_EXTRA_CONF=
export MYCMS_HOST=
export MYCMS_INSTALL=0
export MYCMS_PACKAGE=0
case "${{ matrix.os }}/${{ matrix.crypto}}/${{ matrix.valgrind }}" in
*/*/0)
MYCMS_INSTALL=1
;;
*/*/1)
MYCMS_DO_VALGRIND=1
MYCMS_DEPS="${MYCMS_DEPS} valgrind"
MYCMS_INSTALL=0
;;
esac
case "${{ matrix.os }}/${{ matrix.crypto}}/${{ matrix.valgrind }}" in
linux/*/*)
MYCMS_DEPS="${MYCMS_DEPS} softhsm"
;;
windows/*/*)
MYCMS_HOST="x86_64-w64-mingw32"
MYCMS_DEPS="${MYCMS_DEPS} mingw-w64"
MYCMS_PACKAGE="1"
;;
esac
case "${{ matrix.os }}/${{ matrix.crypto}}/${{ matrix.valgrind }}" in
linux/openssl-1.1.1/*)
MYCMS_DEPS="${MYCMS_DEPS} libssl-dev"
;;
windows/openssl-*/*)
MYCMS_COPY="bin/libcrypto-*-x64.dll"
;;
esac
env | grep '^MYCMS_' >> "${GITHUB_ENV}"
env | grep '.*_CFLAGS\|.*_LIBS' >> "${GITHUB_ENV}" || true
- name: ${{ env.crypto_name }} cache
uses: actions/cache@v4
with:
path: ${{ env.crypto_name }}
key: ${{ env.crypto_name }}-${{ env.caches_version }}
- name: dependencies
run: |
sudo apt update
sudo apt install -y \
build-essential \
easy-rsa \
pkg-config \
${MYCMS_DEPS}
- name: mycms-dist-download
uses: actions/download-artifact@v4
with:
name: mycms-dist
path: dist
- name: mycms-prepare
run: |
tar -xf dist/mycms-*.bz2
ln -s mycms-* mycms
mkdir -p mycms-build/${{ env.mycms_name }}-${{ matrix.valgrind }}
- name: mycms-build
working-directory: mycms-build/${{ env.mycms_name }}-${{ matrix.valgrind }}
run: |
PATH="${GITHUB_WORKSPACE}/${{ env.crypto_name }}/bin:${PATH}" \
"${GITHUB_WORKSPACE}/mycms/conf-dev.sh" \
--host=${MYCMS_HOST} \
PKG_CONFIG_PATH="${GITHUB_WORKSPACE}/${{ env.crypto_name }}/lib/pkgconfig" \
${MYCMS_EXTRA_CONF}
LD_LIBRARY_PATH="${GITHUB_WORKSPACE}/${{ env.crypto_name }}/lib" \
PATH="${GITHUB_WORKSPACE}/${{ env.crypto_name }}/bin:${PATH}" \
make check
if [ "${MYCMS_INSTALL}" = "1" ]; then
make install DESTDIR="${GITHUB_WORKSPACE}/${{ env.mycms_name }}"
fi
if [ -n "${MYCMS_COPY}" ]; then
cp "${GITHUB_WORKSPACE}/${{ env.crypto_name }}"/${MYCMS_COPY} "${GITHUB_WORKSPACE}/${{ env.mycms_name }}/usr/local/bin"
fi
- name: binaries-upload
if: ${{ env.MYCMS_PACKAGE == 1 }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.mycms_name }}
path: |
${{ env.mycms_name }}/usr/local
- name: logs-upload
if: always()
uses: actions/upload-artifact@v4
with:
name: logs.${{ github.jobs[github.job].name }}
path: |
**/*.log
B-generic-wsl:
if: false
name: ${{ matrix.crypto }}@B-generic-wsl
needs:
- B-P-mycms-dist
- C-openssl-binaries
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
crypto:
- openssl-1.1.1
- openssl-3.0
- openssl-3.1
defaults:
run:
shell: wsl-bash {0}
env:
crypto_name: ${{ matrix.crypto }}-binaries-windows
mycms_name: mycms-binaries-windows-${{ matrix.crypto }}
WSLENV: GITHUB_WORKSPACE/p
steps:
- name: "Use GNU tar instead BSD tar"
# https://github.com/actions/cache/issues/591
shell: cmd
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
- name: ${{ env.crypto_name }} cache
uses: actions/cache@v4
with:
path: ${{ env.crypto_name }}
key: ${{ env.crypto_name }}-${{ env.caches_version }}
- name: wsl-setup
uses: Vampire/setup-wsl@v3
with:
distribution: Ubuntu-20.04
additional-packages:
build-essential
easy-rsa
mingw-w64
pkg-config
wsl-conf: |
[interop]
enabled=true
appendWindowsPath=false
- name: mycms-dist-download
uses: actions/download-artifact@v4
with:
name: mycms-dist
path: dist
- name: mycms-prepare
run: |
tar -xf dist/mycms-*.bz2
ln -s mycms-* mycms
mkdir -p mycms-build/${{ env.mycms_name }}-wsl
- name: patch
working-directory: mycms
run: |
patch -p0 < wsl-fixup-libtool-argv0.patch
patch -p0 < wsl-fixup-wsl1-skip-env.patch
- name: mycms-build
env:
WSLENV: GITHUB_WORKSPACE/p:Path/l:LT_SKIP_ENV
working-directory: mycms-build/${{ env.mycms_name }}-wsl
run: |
# @BEGIN: WSL1 Workarounds
# Libtool path injection breaks runtime environment
export Path="$(pwd)/src/libmycms/.libs:$(pwd)/src/libmycms-util/.libs:${GITHUB_WORKSPACE}/${{ env.crypto_name }}/bin/:${Path}"
export LT_SKIP_ENV=1
# Absolute POSIX paths are not supported
export TMPDIR=.
# @END: WSL1 Workarounds
"${GITHUB_WORKSPACE}/mycms/conf-dev.sh" \
--host=x86_64-w64-mingw32 \
--prefix=/ \
PKG_CONFIG_PATH="${GITHUB_WORKSPACE}/${{ env.crypto_name }}/lib/pkgconfig" \
PKG_CONFIG="pkg-config --define-prefix"
make check
- name: logs-upload
if: always()
uses: actions/upload-artifact@v4
with:
name: logs.${{ github.jobs[github.job].name }}
path: |
**/*.log
#############################################################################################################
# PACKAGING
#############################################################################################################
B-P-ubuntu:
name: B-P-ubuntu
needs:
- B-P-mycms-dist
runs-on: ubuntu-latest
container:
image: ubuntu:latest
env:
DEBIAN_FRONTEND: noninteractive
TZ: America/New_York
steps:
- name: dependencies
run: |
apt update
apt install -y \
build-essential \
devscripts \
equivs
- name: mycms-dist-download
uses: actions/download-artifact@v4
with:
name: mycms-dist
path: dist
- name: extract
run: |
tar -xf dist/mycms-*.bz2
ln -s mycms-* mycms
- name: prepare
working-directory: mycms
run: |
ln -s packaging/debian
- name: dependencies
working-directory: mycms
run: |
mk-build-deps -i --tool="apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends"
- name: build
working-directory: mycms
run: |
debuild -b -uc -us -i
- name: create-repo
run: |
mkdir mycms-repo
cp *.deb mycms-repo
cd mycms-repo
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
- name: mycms-deb-repo-upload
uses: actions/upload-artifact@v4
with:
name: mycms-deb-repo
path: |
mycms-repo
P-installers-windows:
name: ${{ matrix.crypto }}@P-installers-windows
needs:
- B-generic
runs-on: ubuntu-latest
strategy:
matrix:
crypto:
- openssl-1.1.1
- openssl-3.0
- openssl-3.1
steps:
- name: dependencies
run: |
sudo apt update
sudo apt install \
nsis
- name: mycms-misc-download
uses: actions/download-artifact@v4
with:
name: mycms-binaries-windows-${{ matrix.crypto }}
path: mycms-binaries-windows-${{ matrix.crypto }}
- name: mycms-misc-download
uses: actions/download-artifact@v4
with:
name: mycms-misc
path: misc
- name: prepare
run: |
tar -xf misc/mycms-packaging.tar.gz
- name: mycms-package
run: |
DESTDIR="mycms-binaries-windows-${{ matrix.crypto }}" \
EXTRA_NAME="$(echo "${{ matrix.crypto }}" | sed -n -e 's/.*\(-.*\)/\1/p')" \
mycms-packaging/windows-nsis/build
- name: installers-upload
uses: actions/upload-artifact@v4
with:
name: mycms-installers-windows-${{ matrix.crypto }}
path: |
mycms-*-setup.exe
#############################################################################################################
# TESTS
#############################################################################################################
T-P-ubuntu:
name: T-P-ubuntu
needs:
- B-P-ubuntu
runs-on: ubuntu-latest
container:
image: ubuntu:latest
options: --privileged
env:
DEBIAN_FRONTEND: noninteractive
TZ: America/New_York
steps:
- name: mycms-deb-repo-download
uses: actions/download-artifact@v4
with:
name: mycms-deb-repo
path: mycms-repo
- name: setup-repo
run: |
cat > /etc/apt/sources.list.d/mycms.list << __EOF__
deb [trusted=yes] file://${GITHUB_WORKSPACE}/mycms-repo ./
__EOF__
- name: install
run: |
apt update
apt install -y \
mycms
- name: test
run: |
mycms-tool --version
T-P-installers-windows:
name: ${{ matrix.crypto }}@T-P-installers-windows
needs:
- P-installers-windows
runs-on: windows-latest
strategy:
matrix:
crypto:
- openssl-1.1.1
- openssl-3.0
- openssl-3.1
steps:
- name: mycms-misc-download
uses: actions/download-artifact@v4
with:
name: mycms-installers-windows-${{ matrix.crypto }}
- name: test
run: |
$f = Get-ChildItem mycms-*-${{ matrix.crypto }}-setup.exe | Select-Object -First 1
$p = Start-Process -FilePath $f -Wait -Verb RunAs -PassThru -ArgumentList "/S","/SELECT_MYCMS_TOOLS=1","/SELECT_MYCMS_SDK=1","/D=C:\Program Files\mycms"
if ($p.ExitCode -ne 0) {
throw "FAIL (Install)"
}
if (-not(Test-Path -Path "C:\Program Files\mycms\include\mycms\mycms.h" -PathType Leaf)) {
throw "The install failed"
}
$p = Start-Process -FilePath "C:\Program Files\mycms\bin\mycms-tool.exe" -ArgumentList "--version" -NoNewWindow -Wait -PassThru
if ($p.ExitCode -ne 0) {
throw "FAIL (Sanity)"
}