name: Build Tests on: push: branches: - main - develop - release-* - gh-workflows pull_request: branches: - main - develop env: PLATFORM: posix TESTS: yes FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true OPENHITLS_REPO: https://gitcode.com/openHiTLS/openhitls.git # Pinned until the next openHiTLS release OPENHITLS_REF: 0a7d5a3748f94c594832a16a7a970cb19d8b4b12 jobs: pre-commit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: python-version: 3.x - uses: pre-commit/action@v3.0.1 scan-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: setup run: | sudo apt-get update && sudo apt-get install -y libcunit1-dev libtool libtool-bin exuberant-ctags clang-tools ./autogen.sh - name: check run: | ./configure --disable-documentation --disable-doxygen --disable-man --enable-examples --enable-tests --disable-dtls scan-build --status-bugs make V=0 check-missing-updates: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: setup run: | sudo apt-get update && sudo apt-get install -y libcunit1-dev libtool libtool-bin exuberant-ctags clang-tools ./autogen.sh - name: configure run: | ./configure --disable-documentation --disable-doxygen --disable-man --enable-examples --enable-tests --disable-dtls - name: check run: | scripts/check-missing-updates.sh build-linux: runs-on: ubuntu-latest strategy: matrix: CC: ["gcc", "clang"] TLS: ["no", "openssl", "gnutls", "mbedtls", "wolfssl", "openhitls"] steps: - uses: actions/checkout@v6 - name: setup run: | sudo apt-get update && sudo apt-get install -y libcunit1-dev libmbedtls-dev libgnutls28-dev libwolfssl-dev libtool libtool-bin exuberant-ctags valgrind ./autogen.sh - name: cache openHiTLS if: matrix.TLS == 'openhitls' id: cache_openhitls uses: actions/cache@v4 with: path: ${{ runner.temp }}/openhitls-prefix key: openhitls-${{ runner.os }}-${{ runner.arch }}-${{ env.OPENHITLS_REF }}-full - name: build openHiTLS if: matrix.TLS == 'openhitls' && steps.cache_openhitls.outputs.cache-hit != 'true' run: | rm -rf "$RUNNER_TEMP/openhitls-src" "$RUNNER_TEMP/openhitls-prefix" git init "$RUNNER_TEMP/openhitls-src" cd "$RUNNER_TEMP/openhitls-src" git remote add origin "$OPENHITLS_REPO" git fetch --depth 1 origin "$OPENHITLS_REF" git checkout FETCH_HEAD cmake -S . -B build -DHITLS_BUILD_PROFILE=full -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel "$(nproc)" cmake --install build --prefix "$RUNNER_TEMP/openhitls-prefix" - name: install openHiTLS if: matrix.TLS == 'openhitls' run: | sudo cp -a "$RUNNER_TEMP/openhitls-prefix/." /usr/local/ sudo ldconfig - name: configure no-TLS if: matrix.TLS == 'no' run: | mkdir build-${{matrix.TLS}}-${{matrix.CC}} cd build-${{matrix.TLS}}-${{matrix.CC}} $GITHUB_WORKSPACE/configure --disable-silent-rules --disable-documentation --enable-examples --enable-tests --disable-dtls CC=${{matrix.CC}} - name: configure TLS if: matrix.TLS != 'no' run: | mkdir build-${{matrix.TLS}}-${{matrix.CC}} cd build-${{matrix.TLS}}-${{matrix.CC}} "$GITHUB_WORKSPACE/configure" --disable-silent-rules --disable-documentation --enable-examples --enable-tests --with-${{matrix.TLS}} CC=${{matrix.CC}} - name: compile run: | cd build-${{matrix.TLS}}-${{matrix.CC}} make EXTRA_CFLAGS=-Werror && make check EXTRA_CFLAGS=-Werror - name: test run: | cd build-${{matrix.TLS}}-${{matrix.CC}} libtool --mode=execute valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression tests/testdriver examples/coap-server -? 2>&1 | head -10 build-linux2: runs-on: ubuntu-latest strategy: matrix: CC: ["gcc", "clang"] TLS: ["mbedtls", "openhitls"] OSCORE_ONLY: ["yes", "no"] steps: - uses: actions/checkout@v6 - name: setup run: | sudo apt-get update && sudo apt-get install -y libcunit1-dev libmbedtls-dev libgnutls28-dev libwolfssl-dev libtool libtool-bin exuberant-ctags valgrind ./autogen.sh - name: cache openHiTLS if: matrix.TLS == 'openhitls' id: cache_openhitls uses: actions/cache@v4 with: path: ${{ runner.temp }}/openhitls-prefix key: openhitls-${{ runner.os }}-${{ runner.arch }}-${{ env.OPENHITLS_REF }}-full - name: build openHiTLS if: matrix.TLS == 'openhitls' && steps.cache_openhitls.outputs.cache-hit != 'true' run: | rm -rf "$RUNNER_TEMP/openhitls-src" "$RUNNER_TEMP/openhitls-prefix" git init "$RUNNER_TEMP/openhitls-src" cd "$RUNNER_TEMP/openhitls-src" git remote add origin "$OPENHITLS_REPO" git fetch --depth 1 origin "$OPENHITLS_REF" git checkout FETCH_HEAD cmake -S . -B build -DHITLS_BUILD_PROFILE=full -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel "$(nproc)" cmake --install build --prefix "$RUNNER_TEMP/openhitls-prefix" - name: install openHiTLS if: matrix.TLS == 'openhitls' run: | sudo cp -a "$RUNNER_TEMP/openhitls-prefix/." /usr/local/ sudo ldconfig - name: configure OSCORE Only if: matrix.OSCORE_ONLY == 'yes' run: | mkdir build-${{matrix.TLS}}-${{matrix.CC}}-${{matrix.OSCORE_ONLY}} cd build-${{matrix.TLS}}-${{matrix.CC}}-${{matrix.OSCORE_ONLY}} $GITHUB_WORKSPACE/configure --disable-silent-rules --disable-documentation --enable-examples --enable-tests --with-${{matrix.TLS}}-oscore --disable-dtls CC=${{matrix.CC}} - name: configure OSCORE + DTLS if: matrix.OSCORE_ONLY == 'no' run: | mkdir build-${{matrix.TLS}}-${{matrix.CC}}-${{matrix.OSCORE_ONLY}} cd build-${{matrix.TLS}}-${{matrix.CC}}-${{matrix.OSCORE_ONLY}} $GITHUB_WORKSPACE/configure --disable-silent-rules --disable-documentation --enable-examples --enable-tests --with-${{matrix.TLS}}-oscore --enable-dtls CC=${{matrix.CC}} - name: compile run: | cd build-${{matrix.TLS}}-${{matrix.CC}}-${{matrix.OSCORE_ONLY}} make EXTRA_CFLAGS=-Werror && make check EXTRA_CFLAGS=-Werror - name: test run: | cd build-${{matrix.TLS}}-${{matrix.CC}}-${{matrix.OSCORE_ONLY}} libtool --mode=execute valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression tests/testdriver examples/coap-server -? 2>&1 | head -10 tinydtls-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: submodules: recursive - name: setup run: | sudo apt-get update && sudo apt-get install -y libcunit1-dev libtool libtool-bin exuberant-ctags valgrind ./autogen.sh - name: configure run: | $GITHUB_WORKSPACE/configure --disable-silent-rules --disable-documentation --enable-examples --enable-tests --with-tinydtls - name: compile run: | make EXTRA_CFLAGS=-Werror && make check EXTRA_CFLAGS=-Werror - name: test run: | LD_LIBRARY_PATH=ext/tinydtls libtool --mode=execute valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression tests/testdriver cmake-build: runs-on: ubuntu-latest strategy: matrix: TLS: ["no", "openssl", "gnutls", "mbedtls", "wolfssl", "tinydtls", "openhitls"] steps: - uses: actions/checkout@v6 with: submodules: recursive - name: setup run: | sudo apt-get update && sudo apt-get install -y libcunit1-dev libmbedtls-dev libgnutls28-dev libwolfssl-dev valgrind cmake -E make_directory $GITHUB_WORKSPACE/build-${{matrix.TLS}}-cmake - name: cache openHiTLS if: matrix.TLS == 'openhitls' id: cache_openhitls uses: actions/cache@v4 with: path: ${{ runner.temp }}/openhitls-prefix key: openhitls-${{ runner.os }}-${{ runner.arch }}-${{ env.OPENHITLS_REF }}-full - name: build openHiTLS if: matrix.TLS == 'openhitls' && steps.cache_openhitls.outputs.cache-hit != 'true' run: | rm -rf "$RUNNER_TEMP/openhitls-src" "$RUNNER_TEMP/openhitls-prefix" git init "$RUNNER_TEMP/openhitls-src" cd "$RUNNER_TEMP/openhitls-src" git remote add origin "$OPENHITLS_REPO" git fetch --depth 1 origin "$OPENHITLS_REF" git checkout FETCH_HEAD cmake -S . -B build -DHITLS_BUILD_PROFILE=full -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel "$(nproc)" cmake --install build --prefix "$RUNNER_TEMP/openhitls-prefix" - name: install openHiTLS if: matrix.TLS == 'openhitls' run: | sudo cp -a "$RUNNER_TEMP/openhitls-prefix/." /usr/local/ sudo ldconfig - name: configure no-TLS if: matrix.TLS == 'no' run: | cd $GITHUB_WORKSPACE/build-${{matrix.TLS}}-cmake cmake $GITHUB_WORKSPACE -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON -DENABLE_DTLS=OFF -DENABLE_DOCS=OFF -DWARNING_TO_ERROR=ON - name: configure TLS if: matrix.TLS != 'no' && matrix.TLS != 'mbedtls-oscore-only' run: | cd $GITHUB_WORKSPACE/build-${{matrix.TLS}}-cmake cmake $GITHUB_WORKSPACE -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON -DENABLE_DTLS=ON -DENABLE_DOCS=OFF -DDTLS_BACKEND=${{matrix.TLS}} -DWARNING_TO_ERROR=ON - name: build run: | cd $GITHUB_WORKSPACE/build-${{matrix.TLS}}-cmake cmake --build . - name: test run: | cd $GITHUB_WORKSPACE/build-${{matrix.TLS}}-cmake valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression ./testdriver ./coap-server -? 2>&1 | head -10 cmake-build2: runs-on: ubuntu-latest strategy: matrix: TLS: ["mbedtls", "openhitls"] OSCORE_ONLY: ["yes", "no"] steps: - uses: actions/checkout@v6 with: submodules: recursive - name: setup run: | sudo apt-get update && sudo apt-get install -y libcunit1-dev libmbedtls-dev libgnutls28-dev libwolfssl-dev valgrind cmake -E make_directory $GITHUB_WORKSPACE/build-${{matrix.TLS}}-${{matrix.OSCORE_ONLY}}-cmake - name: cache openHiTLS if: matrix.TLS == 'openhitls' id: cache_openhitls uses: actions/cache@v4 with: path: ${{ runner.temp }}/openhitls-prefix key: openhitls-${{ runner.os }}-${{ runner.arch }}-${{ env.OPENHITLS_REF }}-full - name: build openHiTLS if: matrix.TLS == 'openhitls' && steps.cache_openhitls.outputs.cache-hit != 'true' run: | rm -rf "$RUNNER_TEMP/openhitls-src" "$RUNNER_TEMP/openhitls-prefix" git init "$RUNNER_TEMP/openhitls-src" cd "$RUNNER_TEMP/openhitls-src" git remote add origin "$OPENHITLS_REPO" git fetch --depth 1 origin "$OPENHITLS_REF" git checkout FETCH_HEAD cmake -S . -B build -DHITLS_BUILD_PROFILE=full -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel "$(nproc)" cmake --install build --prefix "$RUNNER_TEMP/openhitls-prefix" - name: install openHiTLS if: matrix.TLS == 'openhitls' run: | sudo cp -a "$RUNNER_TEMP/openhitls-prefix/." /usr/local/ sudo ldconfig - name: configure OSCORE Only if: matrix.OSCORE_ONLY == 'yes' run: | cd $GITHUB_WORKSPACE/build-${{matrix.TLS}}-${{matrix.OSCORE_ONLY}}-cmake cmake $GITHUB_WORKSPACE -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON -DOSCORE_BACKEND=${{matrix.TLS}} -DENABLE_DTLS=OFF -DENABLE_DOCS=OFF -DWARNING_TO_ERROR=ON - name: configure OSCORE and DTLS if: matrix.OSCORE_ONLY == 'no' run: | cd $GITHUB_WORKSPACE/build-${{matrix.TLS}}-${{matrix.OSCORE_ONLY}}-cmake cmake $GITHUB_WORKSPACE -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON -DOSCORE_BACKEND=${{matrix.TLS}} -DENABLE_DTLS=ON -DENABLE_DOCS=OFF -DWARNING_TO_ERROR=ON - name: build run: | cd $GITHUB_WORKSPACE/build-${{matrix.TLS}}-${{matrix.OSCORE_ONLY}}-cmake cmake --build . - name: test run: | cd $GITHUB_WORKSPACE/build-${{matrix.TLS}}-${{matrix.OSCORE_ONLY}}-cmake valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression ./testdriver ./coap-server -? 2>&1 | head -10 cmake-macos: runs-on: macos-latest steps: - uses: actions/checkout@v6 - name: macOS CMake setup run: | cmake -E make_directory build_test - name: macOS CMake configure run: | cd build_test cmake .. -DWARNING_TO_ERROR=ON -DENABLE_TESTS=NO -DENABLE_DTLS=NO - name: macOS CMake build run: | cd build_test cmake --build . contiki-build-macos: runs-on: macos-latest steps: - uses: actions/checkout@v6 - name: install macOS software run: | brew install make automake libtool - name: compile run: | gmake -C examples/contiki other-build: runs-on: ubuntu-latest strategy: matrix: OS: ["contiki", "lwip", "riot", "zephyr"] steps: - uses: actions/checkout@v6 - name: setup run: | sudo apt-get update && sudo apt-get install -y libc6-dev-i386 lib32stdc++-13-dev - name: compile run: | make -C examples/${{matrix.OS}} EXTRA_CFLAGS=-Werror ms-build: runs-on: windows-latest steps: - uses: actions/checkout@v6 - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v3 - name: Install OpenSSL on Windows (choco) run: call .\scripts\msinstallopenssl.cmd shell: cmd - name: Build sln shell: cmd run: call .\scripts\msbuild.sln.cmd ms-cmake: runs-on: windows-latest steps: - uses: actions/checkout@v6 - name: Install OpenSSL on Windows (choco) run: call .\scripts\msinstallopenssl.cmd shell: cmd - name: MS CMake setup run: | cmake -E make_directory build_test - name: MS CMake configure run: | cd build_test cmake .. -DWARNING_TO_ERROR=ON -DWITH_OPENSSL=YES -DENABLE_THREAD_SAFE=OFF - name: MS CMake build run: | cd build_test cmake --build . mingw-cmake: runs-on: windows-latest strategy: matrix: OS: ["UCRT64", "CLANG64", "MINGW64", "MINGW32"] defaults: run: shell: msys2 {0} steps: - uses: actions/checkout@v6 - name: Environment Setup shell: bash run: | if [ "${{matrix.OS}}" = "UCRT64" ]; then mingw_var="ucrt-x86_64" elif [ "${{matrix.OS}}" = "CLANG64" ]; then mingw_var="clang-x86_64" elif [ "${{matrix.OS}}" = "MINGW64" ]; then mingw_var="x86_64" elif [ "${{matrix.OS}}" = "MINGW32" ]; then mingw_var="i686" else echo "Unsupported MinGW variant: ${{matrix.OS}}" mingw_var="" fi echo "MINGW_VARIANT=${mingw_var}" >> $GITHUB_ENV - uses: msys2/setup-msys2@v2 with: msystem: ${{matrix.OS}} update: true install: git mingw-w64-${{env.MINGW_VARIANT}}-gcc mingw-w64-${{env.MINGW_VARIANT}}-cmake mingw-w64-${{env.MINGW_VARIANT}}-openssl - name: MinGW ${{matrix.OS}} build run: | echo 'Running in MSYS2 ${{matrix.OS}}!' scripts/mingw-cmake.sh additional-tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: submodules: recursive - name: setup run: | sudo apt-get update && sudo apt-get install -y libgnutls28-dev libtool libtool-bin exuberant-ctags ./autogen.sh - name: configure run: ./configure --disable-tests --disable-documentation - name: build run: | make make EXTRA_CFLAGS=-Werror -C tests/oss-fuzz -f Makefile.ci check clean documentation: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: submodules: recursive - name: setup run: | sudo apt-get update && sudo apt-get install -y libtool libtool-bin exuberant-ctags graphviz doxygen libxml2-utils xsltproc docbook-xml docbook-xsl asciidoc pre-commit ./autogen.sh - name: configure run: ./configure --disable-tests --enable-documentation --prefix $GITHUB_WORKSPACE/test-install - name: manuals check run: | make -C man - name: manual page examples check run: | scripts/check_examples.sh - name: doxygen check run: | make -C doc - name: installation check run: | make install && ls -lR $GITHUB_WORKSPACE/test-install distribution: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: submodules: recursive - name: setup run: | sudo apt-get update && sudo apt-get install -y libcunit1-dev libtool libtool-bin exuberant-ctags graphviz doxygen libxml2-utils xsltproc docbook-xml docbook-xsl asciidoc libc6-dev-i386 ./autogen.sh - name: configure run: | mkdir build-dist cd build-dist $GITHUB_WORKSPACE/configure --enable-silent-rules --enable-documentation --enable-examples --disable-dtls - name: build distribution run: | cd build-dist make dist - name: check distribution build run: | cd build-dist $GITHUB_WORKSPACE/scripts/github_dist.sh shell: bash