Skip to content

Commit 8485518

Browse files
flichtenheldcron2
authored andcommitted
GHA: Factor out building SSL libs to a reusable workflow
We amassed a lot of code duplication there. Make it easier to track the differences between the libraries. Change-Id: I3d89016ccae297cfa596897c11a518f1ffbe3dc8 Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> Acked-by: Yuriy Darnobyt <yura.uddr@gmail.com> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1630 Message-Id: <20260420160732.9492-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36686.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
1 parent 7f870c0 commit 8485518

3 files changed

Lines changed: 156 additions & 314 deletions

File tree

.github/workflows/build.yaml

Lines changed: 38 additions & 313 deletions
Original file line numberDiff line numberDiff line change
@@ -304,324 +304,49 @@ jobs:
304304
!${{ github.workspace }}/out/**/vcpkg_installed/**
305305
306306
libressl:
307-
strategy:
308-
fail-fast: false
309-
matrix:
310-
os: [ubuntu-24.04]
311-
ssllib: [libressl]
312-
build: [ normal, asan ]
313-
configureflags: ["--with-openssl-engine=no"]
314-
include:
315-
- build: asan
316-
cflags: "-fsanitize=address -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
317-
ldflags: -fsanitize=address -fno-sanitize-recover=all
318-
cc: clang
319-
- build: normal
320-
cflags: "-O2 -g"
321-
ldflags: ""
322-
cc: gcc
323-
324-
name: "${{matrix.cc}} ${{matrix.build}} - ${{matrix.os}} - ${{matrix.ssllib}}"
325-
runs-on: ${{matrix.os}}
326-
env:
327-
CFLAGS: ${{ matrix.cflags }}
328-
LDFLAGS: ${{ matrix.ldflags }}
329-
CC: ${{matrix.cc}}
330-
UBSAN_OPTIONS: print_stacktrace=1
307+
uses: ./.github/workflows/test-ssllib.yml
308+
with:
309+
libname: libressl
310+
ovpnlibdesc: LibreSSL
331311
# versioning=semver-coerced
332-
LIBRESSL_REPO: libressl/portable
333-
LIBRESSL_VERSION: v4.2.1
334-
LIBRESSL_INSTALL: /opt/libressl
335-
336-
steps:
337-
- name: Install dependencies
338-
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 }}
345-
- name: "libressl: checkout"
346-
if: steps.libressl-cache.outputs.cache-hit != 'true'
347-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
348-
with:
349-
path: libressl
350-
repository: ${{ env.LIBRESSL_REPO }}
351-
ref: ${{ env.LIBRESSL_VERSION }}
352-
- name: "libressl: autogen.sh"
353-
if: steps.libressl-cache.outputs.cache-hit != 'true'
354-
env:
355-
LIBRESSL_GIT_OPTIONS: "--no-single-branch"
356-
run: ./autogen.sh
357-
working-directory: libressl
358-
- name: "libressl: configure"
359-
if: steps.libressl-cache.outputs.cache-hit != 'true'
360-
run: ./configure --prefix=${{ env.LIBRESSL_INSTALL }}
361-
working-directory: libressl
362-
- name: "libressl: make all"
363-
if: steps.libressl-cache.outputs.cache-hit != 'true'
364-
run: make -j3
365-
working-directory: libressl
366-
- name: "libressl: make install"
367-
if: steps.libressl-cache.outputs.cache-hit != 'true'
368-
run: sudo make install
369-
working-directory: libressl
370-
- name: "ldconfig"
371-
run: sudo ldconfig
372-
- name: Checkout OpenVPN
373-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
374-
- name: autoconf
375-
run: autoreconf -fvi
376-
- name: configure
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}}
382-
- name: make all
383-
run: make -j3
384-
- name: Ensure the build uses LibreSSL
385-
run: |
386-
./src/openvpn/openvpn --version
387-
./src/openvpn/openvpn --version | grep -q "library versions: LibreSSL"
388-
- name: configure checks
389-
run: echo 'RUN_SUDO="sudo -E"' >tests/t_server_null.rc
390-
- name: make check
391-
run: make -j3 check VERBOSE=1
392-
393-
openssl:
394-
strategy:
395-
fail-fast: false
396-
matrix:
397-
os: [ubuntu-24.04]
398-
ssllib: [openssl]
399-
build: [ normal, asan ]
400-
configureflags: ["--with-openssl-engine=no"]
401-
include:
402-
- build: asan
403-
cflags: "-fsanitize=address -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
404-
ldflags: -fsanitize=address -fno-sanitize-recover=all
405-
cc: clang
406-
- build: normal
407-
cflags: "-O2 -g"
408-
ldflags: ""
409-
cc: gcc
410-
411-
name: "${{matrix.cc}} ${{matrix.build}} - ${{matrix.os}} - ${{matrix.ssllib}} - 4.0"
412-
runs-on: ${{matrix.os}}
413-
env:
414-
CFLAGS: ${{ matrix.cflags }}
415-
LDFLAGS: ${{ matrix.ldflags }}
416-
CC: ${{matrix.cc}}
417-
UBSAN_OPTIONS: print_stacktrace=1
312+
ghrepo: libressl/portable
313+
gitref: v4.2.1
314+
libconfigure: "LIBRESSL_GIT_OPTIONS=--no-single-branch ./autogen.sh && ./configure --prefix=$LIBPREFIX"
315+
316+
openssl4:
317+
uses: ./.github/workflows/test-ssllib.yml
318+
with:
319+
libname: openssl
320+
ovpnlibdesc: OpenSSL 4.
418321
# versioning=semver-coerced
419-
OPENSSL_REPO: openssl/openssl
420-
OPENSSL_VERSION: openssl-4.0.0-beta1
421-
OPENSSL_INSTALL: /opt/openssl
422-
423-
steps:
424-
- name: Install dependencies
425-
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
426-
- name: Restore OpenSSL 4.0 from cache
427-
uses: actions/cache@v5
428-
id: openssl-cache
429-
with:
430-
path: ${{ env.OPENSSL_INSTALL }}
431-
key: ${{ matrix.os }}-openssl-${{matrix.build }}-${{ env.OPENSSL_VERSION }}
432-
- name: "openssl: checkout"
433-
if: steps.openssl-cache.outputs.cache-hit != 'true'
434-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
435-
with:
436-
path: openssl
437-
repository: ${{ env.OPENSSL_REPO }}
438-
ref: ${{ env.OPENSSL_VERSION }}
439-
- name: "openssl: configure"
440-
if: steps.openssl-cache.outputs.cache-hit != 'true'
441-
run: ./Configure --prefix=${{ env.OPENSSL_INSTALL }} --libdir=${{ env.OPENSSL_INSTALL }}/lib --openssldir=${{ env.OPENSSL_INSTALL }} -g
442-
working-directory: openssl
443-
- name: "openssl: make all"
444-
if: steps.openssl-cache.outputs.cache-hit != 'true'
445-
run: make -j3
446-
working-directory: openssl
447-
- name: "openssl: make install"
448-
if: steps.openssl-cache.outputs.cache-hit != 'true'
449-
run: sudo make install
450-
working-directory: openssl
451-
- name: "ldconfig"
452-
run: sudo ldconfig
453-
- name: Checkout OpenVPN
454-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
455-
- name: autoconf
456-
run: autoreconf -fvi
457-
- name: configure
458-
run: |
459-
OPENSSL_CFLAGS="-I${{ env.OPENSSL_INSTALL }}/include" \
460-
OPENSSL_LIBS="-L${{ env.OPENSSL_INSTALL }}/lib -lssl -lcrypto" \
461-
LDFLAGS="-Wl,-rpath=${{ env.OPENSSL_INSTALL }}/lib" \
462-
./configure --with-crypto-library=openssl --enable-werror ${{matrix.configureflags}}
463-
- name: make all
464-
run: make -j3
465-
- name: Ensure the build uses Openssl
466-
run: |
467-
./src/openvpn/openvpn --version
468-
./src/openvpn/openvpn --version | grep -q "library versions: OpenSSL 4.0"
469-
- name: configure checks
470-
run: echo 'RUN_SUDO="sudo -E"' >tests/t_server_null.rc
471-
- name: make check
472-
run: make -j3 check VERBOSE=1
322+
ghrepo: openssl/openssl
323+
gitref: openssl-4.0.0-beta1
324+
libconfigure: ./Configure --prefix=$LIBPREFIX --libdir=$LIBPREFIX/lib --openssldir=$LIBPREFIX -g
473325

474326
mbedtls4:
475-
strategy:
476-
fail-fast: false
477-
matrix:
478-
os: [ubuntu-24.04]
479-
ssllib: [mbedtls4]
480-
build: [ normal, asan ]
481-
include:
482-
- build: asan
483-
cflags: "-fsanitize=address -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
484-
ldflags: -fsanitize=address -fno-sanitize-recover=all
485-
cc: clang
486-
- build: normal
487-
cflags: "-O2 -g"
488-
ldflags: ""
489-
cc: gcc
490-
491-
name: "${{matrix.cc}} ${{matrix.build}} - ${{matrix.os}} - ${{matrix.ssllib}}"
492-
runs-on: ${{matrix.os}}
493-
env:
494-
CFLAGS: ${{ matrix.cflags }}
495-
LDFLAGS: ${{ matrix.ldflags }}
496-
CC: ${{matrix.cc}}
497-
UBSAN_OPTIONS: print_stacktrace=1
498-
PKG_CONFIG_PATH: /opt/mbedtls4/lib/pkgconfig
327+
uses: ./.github/workflows/test-ssllib.yml
328+
with:
329+
libname: mbedtls
330+
ovpnlibname: mbedtls
331+
ovpnlibdesc: mbed TLS 4.
499332
# versioning=semver-coerced
500-
MBEDTLS_REPO: Mbed-TLS/mbedtls
501-
MBEDTLS_VERSION: v4.0.0
502-
MBEDTLS_INSTALL: /opt/mbedtls4
503-
504-
steps:
505-
- name: Install dependencies
506-
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
507-
- name: Restore mbed TLS from cache
508-
uses: actions/cache@v5
509-
id: mbedtls-cache
510-
with:
511-
path: ${{ env.MBEDTLS_INSTALL }}
512-
key: ${{ matrix.os }}-mbedtls-${{matrix.build }}-${{ env.MBEDTLS_VERSION }}
513-
- name: "mbedtls: checkout"
514-
if: steps.mbedtls-cache.outputs.cache-hit != 'true'
515-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
516-
with:
517-
path: mbedtls
518-
submodules: recursive
519-
repository: ${{ env.MBEDTLS_REPO }}
520-
ref: ${{ env.MBEDTLS_VERSION }}
521-
- uses: lukka/get-cmake@f176ccd3f28bda569c43aae4894f06b2435a3375 # v4.2.3
522-
- name: "mbedtls: cmake"
523-
if: steps.mbedtls-cache.outputs.cache-hit != 'true'
524-
run: cmake -B build -DCMAKE_INSTALL_PREFIX=${{ env.MBEDTLS_INSTAL }}
525-
working-directory: mbedtls
526-
- name: "mbedtls: cmake --build"
527-
if: steps.mbedtls-cache.outputs.cache-hit != 'true'
528-
run: cmake --build build
529-
working-directory: mbedtls
530-
- name: "mbedtls: cmake --install"
531-
if: steps.mbedtls-cache.outputs.cache-hit != 'true'
532-
run: sudo cmake --install build
533-
working-directory: mbedtls
534-
- name: Checkout OpenVPN
535-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
536-
- name: autoconf
537-
run: autoreconf -fvi
538-
- name: configure
539-
run: ./configure --with-crypto-library=mbedtls --enable-werror
540-
- name: make all
541-
run: make -j3
542-
- name: Ensure the build uses mbed TLS ${{ env.MBEDTLS_VERSION }}
543-
run: |
544-
./src/openvpn/openvpn --version
545-
./src/openvpn/openvpn --version | grep -q "library versions: mbed TLS 4."
546-
- name: configure checks
547-
run: echo 'RUN_SUDO="sudo -E"' >tests/t_server_null.rc
548-
- name: make check
549-
run: make -j3 check VERBOSE=1
333+
ghrepo: Mbed-TLS/mbedtls
334+
gitref: v4.0.0
335+
libconfigure: cmake -B build -DCMAKE_INSTALL_PREFIX=$LIBPREFIX
336+
libmake: cmake --build build
337+
libinstall: sudo cmake --install build
338+
ovpnconfigureenv: PKG_CONFIG_PATH=$LIBPREFIX/lib/pkgconfig
550339

551340
aws-lc:
552-
strategy:
553-
fail-fast: false
554-
matrix:
555-
os: [ubuntu-24.04]
556-
ssllib: [ awslc ]
557-
build: [ normal, asan ]
558-
include:
559-
- build: asan
560-
cflags: "-fsanitize=address -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
561-
ldflags: -fsanitize=address -fno-sanitize-recover=all
562-
cc: clang
563-
cxx: clang++
564-
- build: normal
565-
cflags: "-O2 -g"
566-
ldflags: ""
567-
cc: gcc
568-
cxx: c++
569-
570-
name: "${{matrix.cc}} ${{matrix.build}} - ${{matrix.os}} - ${{matrix.ssllib}}"
571-
runs-on: ${{matrix.os}}
572-
env:
573-
CFLAGS: ${{ matrix.cflags }}
574-
LDFLAGS: ${{ matrix.ldflags }}
575-
CC: ${{matrix.cc}}
576-
CXX: ${{matrix.cxx}}
577-
UBSAN_OPTIONS: print_stacktrace=1
578-
AWS_LC_INSTALL: /opt/aws-lc
341+
uses: ./.github/workflows/test-ssllib.yml
342+
with:
343+
libname: aws-lc
344+
ovpnlibdesc: AWS-LC
579345
# versioning=semver-coerced
580-
AWS_LC_REPO: aws/aws-lc
581-
AWS_LC_VERSION: v1.70.0
582-
583-
steps:
584-
- name: Install dependencies
585-
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
586-
- name: Restore AWS-LC from cache
587-
uses: actions/cache@v5
588-
id: aws-lc-cache
589-
with:
590-
path: ${{ env.AWS_LC_INSTALL }}
591-
key: ${{ matrix.os }}-aws-lc-${{matrix.build }}-${{ env.AWS_LC_VERSION }}
592-
- name: "AWS-LC: checkout"
593-
if: steps.aws-lc-cache.outputs.cache-hit != 'true'
594-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
595-
with:
596-
path: aws-lc
597-
repository: ${{ env.AWS_LC_REPO }}
598-
ref: ${{ env.AWS_LC_VERSION }}
599-
- uses: lukka/get-cmake@f176ccd3f28bda569c43aae4894f06b2435a3375 # v4.2.3
600-
- name: "AWS-LC: build"
601-
if: steps.aws-lc-cache.outputs.cache-hit != 'true'
602-
run: |
603-
mkdir build
604-
cd build
605-
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${{ env.AWS_LC_INSTALL }}" -DBUILD_SHARED_LIBS=1 ../
606-
ninja install
607-
working-directory: aws-lc
608-
- name: Checkout OpenVPN
609-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
610-
- name: autoconf
611-
run: autoreconf -fvi
612-
- name: configure with AWS-LC
613-
run: |
614-
OPENSSL_CFLAGS="-I${{ env.AWS_LC_INSTALL }}/include" \
615-
OPENSSL_LIBS="-L${{ env.AWS_LC_INSTALL }}/lib -lssl -lcrypto" \
616-
LDFLAGS="-Wl,-rpath=${{ env.AWS_LC_INSTALL }}/lib" \
617-
./configure --with-crypto-library=openssl
618-
- name: make all
619-
run: make -j3
620-
- name: Ensure the build uses AWS-LC
621-
run: |
622-
./src/openvpn/openvpn --version
623-
./src/openvpn/openvpn --version | grep -q "library versions: AWS-LC"
624-
- name: configure checks
625-
run: echo 'RUN_SUDO="sudo -E"' >tests/t_server_null.rc
626-
- name: make check
627-
run: make -j3 check VERBOSE=1
346+
ghrepo: aws/aws-lc
347+
gitref: v1.70.0
348+
libconfigure: cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$LIBPREFIX" -DBUILD_SHARED_LIBS=1
349+
libmake: cmake --build build
350+
libinstall: sudo cmake --install build
351+
# not ready for --enable-werror
352+
ovpnconfigureflags:

0 commit comments

Comments
 (0)