diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 3471df7..26532c0 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -18,6 +18,7 @@ jobs: matrix: sanitizer: ["address", "leak", "thread", "undefined"] compiler: ["clang-18", "gcc-13"] + example: ["bootstrap_server", "client/udp", "client/tinydtls", "client/raw_block1", "lightclient", "server"] steps: - name: Checkout code including full history and submodules @@ -29,7 +30,7 @@ jobs: - name: Install dependencies from APT repository run: | sudo apt-get update - sudo apt-get install cmake libcunit1-dev ninja-build unzip wget + sudo apt-get install cmake libcunit1-dev ninja-build - name: Build all binaries run: | @@ -43,27 +44,22 @@ jobs: env: CC: ${{ matrix.compiler }} - - name: Build examples for integration tests + - name: Build examples run: | - for example in "server" "bootstrap_server" "client/udp" - do - echo "Building example ${example}" - tools/ci/run_ci.sh \ - --run-clean \ - --run-build \ - --sanitizer ${{ matrix.sanitizer }} \ - --source-directory examples/${example} \ - --build-directory build-wakaama-${example} - done + tools/ci/run_ci.sh \ + --run-clean \ + --run-build \ + --sanitizer ${{ matrix.sanitizer }} \ + --source-directory examples/${{ matrix.example }} \ + --build-directory wakaama-build-${{ matrix.example }} env: CC: ${{ matrix.compiler }} - - name: Install dependencies + - name: Unit test examples run: | - pip install --require-hashes -r tests/integration/requirements.txt - - - name: Execute integration tests - run: | - python -c "import sys; print(sys.version)" - pytest -v tests/integration - + tools/ci/run_ci.sh \ + --run-tests \ + --source-directory examples/${{ matrix.example }} \ + --build-directory wakaama-build-${{ matrix.example }} + env: + CC: ${{ matrix.compiler }} diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml new file mode 100644 index 0000000..0caf951 --- /dev/null +++ b/.github/workflows/integration_test.yaml @@ -0,0 +1,54 @@ +name: Integration Tests + +on: + push: + branches: '**' + pull_request: + branches: '**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build_and_test: + runs-on: ubuntu-24.04 + + strategy: + matrix: + sanitizer: ["address", "leak", "thread", "undefined"] + + steps: + - name: Checkout code including full history and submodules + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: true + fetch-depth: 0 + + - name: Install dependencies from APT repository + run: | + sudo apt-get update + sudo apt-get install cmake libcunit1-dev ninja-build + + - name: Build examples for integration tests + run: | + for example in "server" "bootstrap_server" "client/udp" + do + echo "Building example ${example}" + tools/ci/run_ci.sh \ + --run-clean \ + --run-build \ + --sanitizer ${{ matrix.sanitizer }} \ + --run-tests \ + --source-directory examples/${example} \ + --build-directory build-wakaama-${example} + done + + - name: Install Python test dependencies + run: | + pip install --require-hashes -r tests/integration/requirements.txt + + - name: Execute integration tests + run: | + python -c "import sys; print(sys.version)" + pytest -v tests/integration diff --git a/examples/bootstrap_server/CMakeLists.txt b/examples/bootstrap_server/CMakeLists.txt index 1de8f18..05edf9d 100644 --- a/examples/bootstrap_server/CMakeLists.txt +++ b/examples/bootstrap_server/CMakeLists.txt @@ -13,3 +13,5 @@ add_subdirectory(../../ wakaama_lib) add_executable(bootstrap_server) target_sources(bootstrap_server PRIVATE bootstrap_info.c bootstrap_server.c bootstrap_info.h bootstrap_server.ini) target_link_libraries(bootstrap_server PRIVATE wakaama_static) + +enable_testing() diff --git a/examples/client/raw_block1/CMakeLists.txt b/examples/client/raw_block1/CMakeLists.txt index 810bdc3..1eebb4d 100644 --- a/examples/client/raw_block1/CMakeLists.txt +++ b/examples/client/raw_block1/CMakeLists.txt @@ -33,3 +33,5 @@ target_sources( ) target_link_libraries(lwm2mclient_raw_block1 PRIVATE wakaama_static) + +enable_testing() diff --git a/examples/client/tinydtls/CMakeLists.txt b/examples/client/tinydtls/CMakeLists.txt index 8c1b05d..70fb252 100644 --- a/examples/client/tinydtls/CMakeLists.txt +++ b/examples/client/tinydtls/CMakeLists.txt @@ -32,3 +32,5 @@ target_sources( ) target_link_libraries(lwm2mclient_tinydtls PRIVATE wakaama_static) + +enable_testing() diff --git a/examples/client/udp/CMakeLists.txt b/examples/client/udp/CMakeLists.txt index 8d492db..87531aa 100644 --- a/examples/client/udp/CMakeLists.txt +++ b/examples/client/udp/CMakeLists.txt @@ -32,3 +32,5 @@ target_sources( ) target_link_libraries(lwm2mclient PRIVATE wakaama_static) + +enable_testing() diff --git a/examples/lightclient/CMakeLists.txt b/examples/lightclient/CMakeLists.txt index 6bb5268..62f035b 100644 --- a/examples/lightclient/CMakeLists.txt +++ b/examples/lightclient/CMakeLists.txt @@ -14,3 +14,5 @@ add_subdirectory(../../ wakaama_lib) add_executable(lightclient) target_sources(lightclient PRIVATE lightclient.c object_device.c object_security.c object_server.c object_test.c) target_link_libraries(lightclient PRIVATE wakaama_static) + +enable_testing() diff --git a/examples/server/CMakeLists.txt b/examples/server/CMakeLists.txt index 2b0bb36..2991a94 100644 --- a/examples/server/CMakeLists.txt +++ b/examples/server/CMakeLists.txt @@ -13,3 +13,5 @@ add_subdirectory(../../ wakaama_lib) add_executable(lwm2mserver) target_sources(lwm2mserver PRIVATE lwm2mserver.c) target_link_libraries(lwm2mserver PRIVATE wakaama_static) + +enable_testing()