|
| 1 | +# Copyright(c) 2026 Sven Trittler |
| 2 | +# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause |
| 3 | +name: Native undefined-behavior checks |
| 4 | +on: |
| 5 | + push: |
| 6 | + pull_request: |
| 7 | + workflow_dispatch: |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | +jobs: |
| 11 | + ubsan: |
| 12 | + runs-on: ubuntu-24.04 |
| 13 | + timeout-minutes: 30 |
| 14 | + env: |
| 15 | + UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1 |
| 16 | + CYCLONEDDS_URI: '<CycloneDDS><Domain><General><Interfaces><NetworkInterface address="127.0.0.1"/></Interfaces><AllowMulticast>false</AllowMulticast></General><Discovery><ParticipantIndex>auto</ParticipantIndex><Peers><Peer Address="127.0.0.1"/></Peers></Discovery></Domain></CycloneDDS>' |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v7 |
| 19 | + - uses: actions/setup-java@v6 |
| 20 | + with: |
| 21 | + distribution: temurin |
| 22 | + java-version: '17' |
| 23 | + - name: Build core master or matching release tag and binding with UBSan |
| 24 | + env: |
| 25 | + CYCLONEDDS_CORE_REF: ${{ github.ref_type == 'tag' && format('refs/tags/{0}', github.ref_name) || 'refs/heads/master' }} |
| 26 | + shell: bash |
| 27 | + run: | |
| 28 | + FLAGS='-fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer' |
| 29 | + git init "$RUNNER_TEMP/core" |
| 30 | + git -C "$RUNNER_TEMP/core" remote add origin https://github.com/eclipse-cyclonedds/cyclonedds.git |
| 31 | + git -C "$RUNNER_TEMP/core" fetch --depth 1 origin "$CYCLONEDDS_CORE_REF" |
| 32 | + git -C "$RUNNER_TEMP/core" checkout --detach FETCH_HEAD |
| 33 | + echo "Cyclone DDS core ref: $CYCLONEDDS_CORE_REF" |
| 34 | + git -C "$RUNNER_TEMP/core" rev-parse HEAD |
| 35 | + cmake -S "$RUNNER_TEMP/core" -B "$RUNNER_TEMP/core-build" \ |
| 36 | + -DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/core-install" -DCMAKE_BUILD_TYPE=Debug \ |
| 37 | + "-DCMAKE_C_FLAGS=$FLAGS" -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF \ |
| 38 | + -DENABLE_SECURITY=OFF -DENABLE_SSL=OFF |
| 39 | + cmake --build "$RUNNER_TEMP/core-build" --parallel 4 |
| 40 | + cmake --install "$RUNNER_TEMP/core-build" |
| 41 | + cmake -S . -B build -DCMAKE_PREFIX_PATH="$RUNNER_TEMP/core-install" \ |
| 42 | + -DCYCLONEDDS_CORE_SOURCE_DIR="$RUNNER_TEMP/core" \ |
| 43 | + -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_C_FLAGS=$FLAGS" -DBUILD_EXAMPLES=OFF |
| 44 | + cmake --build build --parallel 4 |
| 45 | + - name: Run functional and resource stress tests |
| 46 | + run: ctest --test-dir build --output-on-failure -j 2 --output-junit test-results.xml |
| 47 | + - uses: actions/upload-artifact@v7 |
| 48 | + if: always() |
| 49 | + with: |
| 50 | + name: ubsan-diagnostics |
| 51 | + path: | |
| 52 | + build/Testing/Temporary/*.log |
| 53 | + build/test-results.xml |
| 54 | + if-no-files-found: ignore |
0 commit comments