Skip to content

Commit a84f8cf

Browse files
schwabecron2
authored andcommitted
GHA: Cache built crypto libraries
Semver code changes by Frank Change-Id: Ie21fdb01b843a7af09fcd469b08c775eee7e3745 Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Frank Lichtenheld <frank@lichtenheld.com> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1577 Message-Id: <20260322103820.4717-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36238.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
1 parent a04a3ce commit a84f8cf

2 files changed

Lines changed: 58 additions & 15 deletions

File tree

.github/workflows/build.yaml

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -328,29 +328,43 @@ jobs:
328328
LDFLAGS: ${{ matrix.ldflags }}
329329
CC: ${{matrix.cc}}
330330
UBSAN_OPTIONS: print_stacktrace=1
331+
# versioning=semver-coerced
332+
LIBRESSL_REPO: libressl/portable
333+
LIBRESSL_VERSION: v4.2.1
334+
LIBRESSL_INSTALL: /opt/libressl
331335

332336
steps:
333337
- name: Install dependencies
334338
run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev linux-libc-dev man2html clang libcmocka-dev python3-docutils libtool automake autoconf pkg-config libcap-ng-dev libnl-genl-3-dev
339+
- name: Restore libressl from cache
340+
uses: actions/cache@v5
341+
id: libressl-cache
342+
with:
343+
path: ${{ env.LIBRESSL_INSTALL }}
344+
key: ${{ matrix.os }}-libressl-${{matrix.build }}-${{ env.LIBRESSL_VERSION }}
335345
- name: "libressl: checkout"
346+
if: steps.libressl-cache.outputs.cache-hit != 'true'
336347
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
337348
with:
338349
path: libressl
339-
# versioning=semver-coerced
340-
repository: libressl/portable
341-
ref: v4.2.1
350+
repository: ${{ env.LIBRESSL_REPO }}
351+
ref: ${{ env.LIBRESSL_VERSION }}
342352
- name: "libressl: autogen.sh"
353+
if: steps.libressl-cache.outputs.cache-hit != 'true'
343354
env:
344355
LIBRESSL_GIT_OPTIONS: "--no-single-branch"
345356
run: ./autogen.sh
346357
working-directory: libressl
347358
- name: "libressl: configure"
348-
run: ./configure
359+
if: steps.libressl-cache.outputs.cache-hit != 'true'
360+
run: ./configure --prefix=${{ env.LIBRESSL_INSTALL }}
349361
working-directory: libressl
350362
- name: "libressl: make all"
363+
if: steps.libressl-cache.outputs.cache-hit != 'true'
351364
run: make -j3
352365
working-directory: libressl
353366
- name: "libressl: make install"
367+
if: steps.libressl-cache.outputs.cache-hit != 'true'
354368
run: sudo make install
355369
working-directory: libressl
356370
- name: "ldconfig"
@@ -360,7 +374,11 @@ jobs:
360374
- name: autoconf
361375
run: autoreconf -fvi
362376
- name: configure
363-
run: ./configure --with-crypto-library=openssl ${{matrix.configureflags}} --enable-werror
377+
run: |
378+
OPENSSL_CFLAGS="-I${{ env.LIBRESSL_INSTALL }}/include" \
379+
OPENSSL_LIBS="-L${{ env.LIBRESSL_INSTALL }}/lib -lssl -lcrypto" \
380+
LDFLAGS="-Wl,-rpath=${{ env.LIBRESSL_INSTALL }}/lib" \
381+
./configure --with-crypto-library=openssl --enable-werror ${{matrix.configureflags}}
364382
- name: make all
365383
run: make -j3
366384
- name: Ensure the build uses LibreSSL
@@ -396,27 +414,41 @@ jobs:
396414
LDFLAGS: ${{ matrix.ldflags }}
397415
CC: ${{matrix.cc}}
398416
UBSAN_OPTIONS: print_stacktrace=1
417+
PKG_CONFIG_PATH: /opt/mbedtls4/lib/pkgconfig
418+
# versioning=semver-coerced
419+
MBEDTLS_REPO: Mbed-TLS/mbedtls
420+
MBEDTLS_VERSION: v4.0.0
421+
MBEDTLS_INSTALL: /opt/mbedtls4
399422

400423
steps:
401424
- name: Install dependencies
402425
run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev linux-libc-dev man2html clang libcmocka-dev python3-docutils python3-jinja2 python3-jsonschema libtool automake autoconf pkg-config libcap-ng-dev libnl-genl-3-dev
426+
- name: Restore mbed TLS from cache
427+
uses: actions/cache@v5
428+
id: mbedtls-cache
429+
with:
430+
path: ${{ env.MBEDTLS_INSTALL }}
431+
key: ${{ matrix.os }}-mbedtls-${{matrix.build }}-${{ env.MBEDTLS_VERSION }}
403432
- name: "mbedtls: checkout"
433+
if: steps.mbedtls-cache.outputs.cache-hit != 'true'
404434
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
405435
with:
406436
path: mbedtls
407437
submodules: recursive
408-
# versioning=semver-coerced
409-
repository: Mbed-TLS/mbedtls
410-
ref: v4.0.0
438+
repository: ${{ env.MBEDTLS_REPO }}
439+
ref: ${{ env.MBEDTLS_VERSION }}
411440
- uses: lukka/get-cmake@f176ccd3f28bda569c43aae4894f06b2435a3375 # v4.2.3
412441
- name: "mbedtls: cmake"
413-
run: cmake -B build
442+
if: steps.mbedtls-cache.outputs.cache-hit != 'true'
443+
run: cmake -B build -DCMAKE_INSTALL_PREFIX=${{ env.MBEDTLS_INSTAL }}
414444
working-directory: mbedtls
415445
- name: "mbedtls: cmake --build"
446+
if: steps.mbedtls-cache.outputs.cache-hit != 'true'
416447
run: cmake --build build
417448
working-directory: mbedtls
418449
- name: "mbedtls: cmake --install"
419-
run: sudo cmake --install build --prefix /usr
450+
if: steps.mbedtls-cache.outputs.cache-hit != 'true'
451+
run: sudo cmake --install build
420452
working-directory: mbedtls
421453
- name: Checkout OpenVPN
422454
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -426,7 +458,7 @@ jobs:
426458
run: ./configure --with-crypto-library=mbedtls --enable-werror
427459
- name: make all
428460
run: make -j3
429-
- name: Ensure the build uses mbed TLS 4.x
461+
- name: Ensure the build uses mbed TLS ${{ env.MBEDTLS_VERSION }}
430462
run: |
431463
./src/openvpn/openvpn --version
432464
./src/openvpn/openvpn --version | grep -q "library versions: mbed TLS 4."
@@ -463,19 +495,29 @@ jobs:
463495
CXX: ${{matrix.cxx}}
464496
UBSAN_OPTIONS: print_stacktrace=1
465497
AWS_LC_INSTALL: /opt/aws-lc
498+
# versioning=semver-coerced
499+
AWS_LC_REPO: aws/aws-lc
500+
AWS_LC_VERSION: v1.70.0
466501

467502
steps:
468503
- name: Install dependencies
469504
run: sudo apt update && sudo apt install -y gcc golang make liblzo2-dev libpam0g-dev liblz4-dev linux-libc-dev man2html clang libcmocka-dev python3-docutils python3-jinja2 python3-jsonschema libtool automake autoconf pkg-config libcap-ng-dev libnl-genl-3-dev
505+
- name: Restore AWS-LC from cache
506+
uses: actions/cache@v5
507+
id: aws-lc-cache
508+
with:
509+
path: ${{ env.AWS_LC_INSTALL }}
510+
key: ${{ matrix.os }}-aws-lc-${{matrix.build }}-${{ env.AWS_LC_VERSION }}
470511
- name: "AWS-LC: checkout"
512+
if: steps.aws-lc-cache.outputs.cache-hit != 'true'
471513
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
472514
with:
473515
path: aws-lc
474-
# versioning=semver-coerced
475-
repository: aws/aws-lc
476-
ref: v1.70.0
516+
repository: ${{ env.AWS_LC_REPO }}
517+
ref: ${{ env.AWS_LC_VERSION }}
477518
- uses: lukka/get-cmake@f176ccd3f28bda569c43aae4894f06b2435a3375 # v4.2.3
478519
- name: "AWS-LC: build"
520+
if: steps.aws-lc-cache.outputs.cache-hit != 'true'
479521
run: |
480522
mkdir build
481523
cd build

renovate.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@
4040
"/^\\.github/workflows/.+\\.ya?ml$/"
4141
],
4242
"matchStrings": [
43-
"versioning=(?<versioning>.*?)\\n\\s*repository:\\s*(?<depName>.*?)\\n\\s*ref:\\s*(?<currentValue>.*?)\\n"
43+
"versioning=(?<versioning>.*?)\\n\\s*.*?_REPO:\\s*(?<depName>.*?)\\n\\s*.*?_VERSION:\\s*(?<currentValue>.*?)\\n"
4444
],
4545
"datasourceTemplate": "github-tags"
4646
}
47+
4748
]
4849
}

0 commit comments

Comments
 (0)