1 # The name of our workflow
9 name: "Check code style with Uncrustify"
10 # Ubuntu 22.04 has uncrustify 0.72_f
13 - name: Install dependencies
14 run: sudo apt update && sudo apt install -y uncrustify
15 - name: Checkout OpenVPN
16 uses: actions/checkout@v3
19 - name: Show uncrustify version
20 run: uncrustify --version
21 - name: Run uncrustify
22 run: ./dev-tools/reformat-all.sh
23 working-directory: openvpn
24 - name: Check for changes
25 run: git diff --output=uncrustify-changes.patch
26 working-directory: openvpn
27 - name: Show changes on standard output
29 working-directory: openvpn
30 - uses: actions/upload-artifact@v3
32 name: uncrustify-changes.patch
33 path: 'openvpn/uncrustify-changes.patch'
34 - name: Set job status
35 run: test ! -s uncrustify-changes.patch
36 working-directory: openvpn
44 name: "gcc-mingw - ${{ matrix.arch }} - OSSL"
47 VCPKG_ROOT: ${{ github.workspace }}/vcpkg
49 - name: Install dependencies
50 run: sudo apt update && sudo apt install -y mingw-w64 unzip cmake ninja-build build-essential wget python3-docutils man2html-base
51 - name: Checkout OpenVPN
52 uses: actions/checkout@v3
54 - name: Restore from cache and install vcpkg
55 uses: lukka/run-vcpkg@v11
57 vcpkgGitCommitId: '1ba9a2591f15af5900f2ce2b3e2bf31771e3ac48'
58 vcpkgJsonGlob: '**/mingw/vcpkg.json'
60 - name: Run CMake with vcpkg.json manifest
61 uses: lukka/run-cmake@v10
63 configurePreset: mingw-${{ matrix.arch }}
64 buildPreset: mingw-${{ matrix.arch }}
65 buildPresetAdditionalArgs: "['--config Debug']"
67 - uses: actions/upload-artifact@v3
69 name: openvpn-mingw-${{ matrix.arch }}
71 ${{ github.workspace }}/out/build/mingw/${{ matrix.arch }}/Debug/*.exe
72 ${{ github.workspace }}/out/build/mingw/${{ matrix.arch }}/Debug/*.dll
73 !${{ github.workspace }}/out/build/mingw/${{ matrix.arch }}/Debug/test_*.exe
75 - uses: actions/upload-artifact@v3
77 name: openvpn-mingw-${{ matrix.arch }}-tests
79 ${{ github.workspace }}/out/build/mingw/${{ matrix.arch }}/Debug/test_*.exe
80 ${{ github.workspace }}/out/build/mingw/${{ matrix.arch }}/Debug/*.dll
88 test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, tls_crypt]
90 runs-on: windows-latest
91 name: "mingw unittest ${{ matrix.test }} - ${{ matrix.arch }} - OSSL"
93 - name: Retrieve mingw unittest
94 uses: actions/download-artifact@v3
96 name: openvpn-mingw-${{ matrix.arch }}-tests
98 - name: Run ${{ matrix.test }} unit test
99 run: ./unittests/test_${{ matrix.test }}.exe
105 os: [ubuntu-20.04, ubuntu-22.04]
106 sslpkg: [libmbedtls-dev]
113 libname: OpenSSL 1.1.1
117 libname: OpenSSL 3.0.2
119 pkcs11pkg: "libpkcs11-helper1-dev softhsm2 gnutls-bin"
120 extraconf: --enable-pkcs11
123 libname: OpenSSL 1.1.1
125 pkcs11pkg: "libpkcs11-helper1-dev softhsm2 gnutls-bin"
126 extraconf: "--enable-iproute2 --enable-pkcs11"
129 libname: OpenSSL 1.1.1
131 extraconf: "--enable-async-push"
134 libname: OpenSSL 1.1.1
136 extraconf: "--disable-management"
139 libname: OpenSSL 1.1.1
141 extraconf: "--enable-small"
144 libname: OpenSSL 1.1.1
146 extraconf: "--disable-lzo --disable-lz4"
148 name: "gcc - ${{matrix.os}} - ${{matrix.libname}} ${{matrix.extraconf}}"
150 SSLPKG: "${{matrix.sslpkg}}"
151 PKCS11PKG: "${{matrix.pkcs11pkg}}"
153 runs-on: ${{matrix.os}}
155 - name: Install dependencies
156 run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev libcap-ng-dev libnl-genl-3-dev linux-libc-dev man2html libcmocka-dev python3-docutils libtool automake autoconf ${SSLPKG} ${PKCS11PKG}
157 - name: Checkout OpenVPN
158 uses: actions/checkout@v3
162 run: ./configure --with-crypto-library=${{matrix.ssllib}} ${{matrix.extraconf}} --enable-werror
166 run: make check VERBOSE=1
173 ssllib: [mbedtls, openssl]
175 name: "clang-asan - ${{matrix.os}} - ${{matrix.ssllib}}"
178 UBSAN_OPTIONS: print_stacktrace=1
180 runs-on: ${{matrix.os}}
182 - name: Install dependencies
183 run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev libcap-ng-dev libnl-genl-3-dev linux-libc-dev man2html clang libcmocka-dev python3-docutils libtool automake autoconf libmbedtls-dev
184 - name: Checkout OpenVPN
185 uses: actions/checkout@v3
189 run: CFLAGS="-fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer -O2" CC=clang ./configure --with-crypto-library=${{matrix.ssllib}} --enable-werror
193 run: make check VERBOSE=1
199 ssllib: [ openssl11, openssl3, libressl]
200 build: [ normal, asan ]
201 os: [macos-11, macos-12, macos-13]
204 cflags: "-fsanitize=address,undefined -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
205 ldflags: -fsanitize=address,undefined -fno-sanitize-recover=all
206 # Our build system ignores LDFLAGS for plugins
207 configureflags: --disable-plugin-auth-pam --disable-plugin-down-root
220 configuressllib: "--with-openssl-engine=no"
222 runs-on: ${{matrix.os}}
223 name: "${{matrix.os}} - ${{matrix.libdir}} - ${{matrix.build}}"
225 CFLAGS: ${{ matrix.cflags }}
226 LDFLAGS: ${{ matrix.ldflags }}
227 OPENSSL_CFLAGS: "-I/usr/local/opt/${{matrix.libdir}}/include"
228 OPENSSL_LIBS: "-L/usr/local/opt/${{matrix.libdir}}/lib -lcrypto -lssl"
229 UBSAN_OPTIONS: print_stacktrace=1
231 - name: Install dependencies
232 run: brew install openssl@1.1 openssl@3 lzo lz4 man2html cmocka libtool automake autoconf libressl
233 - name: Checkout OpenVPN
234 uses: actions/checkout@v3
238 run: ./configure --enable-werror ${{matrix.configureflags}} ${{matrix.configuressllib}}
242 run: make check VERBOSE=1
248 arch: [amd64, x86, arm64]
250 name: "msbuild - ${{ matrix.arch }} - openssl"
252 BUILD_CONFIGURATION: Release
254 runs-on: windows-latest
256 - uses: actions/checkout@v3
257 - uses: lukka/get-cmake@latest
259 - name: Install rst2html
260 run: python -m pip install --upgrade pip docutils
262 - name: Restore artifacts, or setup vcpkg (do not install any package)
263 uses: lukka/run-vcpkg@v11
265 vcpkgGitCommitId: '1ba9a2591f15af5900f2ce2b3e2bf31771e3ac48'
266 vcpkgJsonGlob: '**/windows/vcpkg.json'
268 - name: Run CMake with vcpkg.json manifest (NO TESTS)
269 uses: lukka/run-cmake@v10
270 if: ${{ matrix.arch == 'arm64' }}
272 configurePreset: win-${{ matrix.arch }}-release
273 buildPreset: win-${{ matrix.arch }}-release
275 - name: Run CMake with vcpkg.json manifest
276 uses: lukka/run-cmake@v10
277 if: ${{ matrix.arch != 'arm64' }}
279 configurePreset: win-${{ matrix.arch }}-release
280 buildPreset: win-${{ matrix.arch }}-release
281 testPreset: win-${{ matrix.arch }}-release
283 - uses: actions/upload-artifact@v3
285 name: openvpn-msvc-${{ matrix.arch }}
287 ${{ github.workspace }}/out/**/*.exe
288 ${{ github.workspace }}/out/**/*.dll
289 !${{ github.workspace }}/out/**/test_*.exe
290 !${{ github.workspace }}/out/**/CMakeFiles/**
291 !${{ github.workspace }}/out/**/vcpkg_installed/**
299 build: [ normal, asan ]
300 configureflags: ["--with-openssl-engine=no"]
303 cflags: "-fsanitize=address -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
304 ldflags: -fsanitize=address -fno-sanitize-recover=all
311 name: "${{matrix.cc}} ${{matrix.build}} - ${{matrix.os}} - ${{matrix.ssllib}}"
312 runs-on: ${{matrix.os}}
314 CFLAGS: ${{ matrix.cflags }}
315 LDFLAGS: ${{ matrix.ldflags }}
317 UBSAN_OPTIONS: print_stacktrace=1
320 - name: Install dependencies
321 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
322 - name: "libressl: checkout"
323 uses: actions/checkout@v3
326 repository: libressl/portable
328 - name: "libressl: autogen.sh"
330 working-directory: libressl
331 - name: "libressl: configure"
333 working-directory: libressl
334 - name: "libressl: make all"
336 working-directory: libressl
337 - name: "libressl: make install"
338 run: sudo make install
339 working-directory: libressl
342 - name: Checkout OpenVPN
343 uses: actions/checkout@v3
347 run: ./configure --with-crypto-library=openssl ${{matrix.configureflags}} --enable-werror
351 run: make check VERBOSE=1
359 build: [ normal, asan ]
362 cflags: "-fsanitize=address -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
363 ldflags: -fsanitize=address -fno-sanitize-recover=all
370 name: "${{matrix.cc}} ${{matrix.build}} - ${{matrix.os}} - ${{matrix.ssllib}}"
371 runs-on: ${{matrix.os}}
373 CFLAGS: ${{ matrix.cflags }}
374 LDFLAGS: ${{ matrix.ldflags }}
376 UBSAN_OPTIONS: print_stacktrace=1
379 - name: Install dependencies
380 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
381 - name: "mbedtls: checkout"
382 uses: actions/checkout@v3
385 repository: Mbed-TLS/mbedtls
387 - name: "mbedtls: make no_test"
388 run: make -j3 no_test SHARED=1
389 working-directory: mbedtls
390 - name: "mbedtls: make install"
391 run: sudo make install DESTDIR=/usr
392 working-directory: mbedtls
393 - name: Checkout OpenVPN
394 uses: actions/checkout@v3
398 run: ./configure --with-crypto-library=mbedtls
402 run: make check VERBOSE=1