+name: test_ssllib
+
+on:
+ workflow_call:
+ inputs:
+ libname:
+ required: true
+ type: string
+ ovpnlibname:
+ type: string
+ default: openssl
+ ovpnlibdesc:
+ required: true
+ type: string
+ ghrepo:
+ required: true
+ type: string
+ gitref:
+ required: true
+ type: string
+ libconfigure:
+ required: true
+ type: string
+ libmake:
+ type: string
+ default: "make -j3"
+ libinstall:
+ type: string
+ default: "sudo make install"
+ ovpnconfigureenv:
+ type: string
+ default: >-
+ OPENSSL_CFLAGS="-I$LIBPREFIX/include"
+ OPENSSL_LIBS="-L$LIBPREFIX/lib -lssl -lcrypto"
+ LDFLAGS="-Wl,-rpath=$LIBPREFIX/lib"
+ ovpnconfigureflags:
+ type: string
+ default: --enable-werror --with-openssl-engine=no
+
+jobs:
+ test_ssllib:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-24.04]
+ build: [normal, asan]
+ include:
+ - build: asan
+ cflags: "-fsanitize=address -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
+ ldflags: -fsanitize=address -fno-sanitize-recover=all
+ cc: clang
+ cxx: clang++
+ - build: normal
+ cflags: "-O2 -g"
+ ldflags: ""
+ cc: gcc
+ cxx: g++
+
+ name: "${{matrix.cc}} ${{matrix.build}} - ${{matrix.os}} - ${{inputs.libname}}"
+ runs-on: ${{matrix.os}}
+ env:
+ CFLAGS: ${{matrix.cflags}}
+ LDFLAGS: ${{matrix.ldflags}}
+ CC: ${{matrix.cc}}
+ CXX: ${{matrix.cxx}}
+ UBSAN_OPTIONS: print_stacktrace=1
+ LIBPREFIX: /opt/${{inputs.libname}}
+
+ steps:
+ - name: Install dependencies
+ 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
+ - name: Restore ${{inputs.libname}} from cache
+ uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ id: ssllib-cache
+ with:
+ path: ${{env.LIBPREFIX}}
+ key: ${{matrix.os}}-${{inputs.libname}}-${{matrix.build }}-${{inputs.gitref}}
+ - name: "${{inputs.libname}}: checkout"
+ if: steps.ssllib-cache.outputs.cache-hit != 'true'
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ submodules: recursive
+ path: ${{inputs.libname}}
+ repository: ${{inputs.ghrepo}}
+ ref: ${{inputs.gitref}}
+ - name: "${{inputs.libname}}: configure"
+ if: steps.ssllib-cache.outputs.cache-hit != 'true'
+ run: ${{inputs.libconfigure}}
+ working-directory: ${{inputs.libname}}
+ - name: "${{inputs.libname}}: build"
+ if: steps.ssllib-cache.outputs.cache-hit != 'true'
+ run: ${{inputs.libmake}}
+ working-directory: ${{inputs.libname}}
+ - name: "${{inputs.libname}}: install"
+ if: steps.ssllib-cache.outputs.cache-hit != 'true'
+ run: ${{inputs.libinstall}}
+ working-directory: ${{inputs.libname}}
+ - name: Run ldconfig
+ run: sudo ldconfig
+ - name: "OpenVPN: checkout"
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ - name: "OpenVPN: autoreconf"
+ run: autoreconf -fvi
+ - name: "OpenVPN: configure"
+ run: |
+ ${{inputs.ovpnconfigureenv}} \
+ ./configure --with-crypto-library=${{inputs.ovpnlibname}} ${{inputs.ovpnconfigureflags}}
+ - name: "OpenVPN: build"
+ run: make -j3
+ - name: Ensure the build uses ${{inputs.libname}}
+ run: |
+ ./src/openvpn/openvpn --version
+ ./src/openvpn/openvpn --version | grep -q "library versions: ${{inputs.ovpnlibdesc}}"
+ - name: "OpenVPN: configure checks"
+ run: echo 'RUN_SUDO="sudo -E"' >tests/t_server_null.rc
+ - name: "OpenVPN: make check"
+ run: make -j3 check VERBOSE=1