diff --git a/.github/workflows/config/asan_colcon.meta b/.github/workflows/config/asan_colcon.meta index 5ea0dad1d3d..4a6bd3e2774 100644 --- a/.github/workflows/config/asan_colcon.meta +++ b/.github/workflows/config/asan_colcon.meta @@ -1,7 +1,6 @@ names: fastrtps: cmake-args: - - "-DCMAKE_BUILD_TYPE=Debug" - "-DEPROSIMA_BUILD_TESTS=ON" - "-DRTPS_API_TESTS=ON" - "-DFASTRTPS_API_TESTS=ON" @@ -14,7 +13,6 @@ names: - "-DCMAKE_CXX_FLAGS='-Werror'" discovery-server: cmake-args: - - "-DCMAKE_BUILD_TYPE=Debug" - "-DSANITIZER=Address" googletest-distribution: cmake-args: diff --git a/.github/workflows/sanitizers-ci.yaml b/.github/workflows/sanitizers-ci.yaml new file mode 100644 index 00000000000..b55b83f7e8c --- /dev/null +++ b/.github/workflows/sanitizers-ci.yaml @@ -0,0 +1,176 @@ +name: Fast DDS Sanitizers Analysis + +on: + workflow_dispatch: + inputs: + label: + description: 'ID associated to the workflow' + required: true + type: string + run_asan_fastdds: + description: 'Run Addess Sanitizer job for Fast DDS' + required: false + type: boolean + colcon_meta: + description: 'Optional Path of the colcon meta file' + required: false + type: string + colcon_build_args: + description: 'Optional colcon build arguments' + required: false + type: string + colcon_test_args: + description: 'Optional colcon test arguments' + required: false + type: string + cmake_args: + description: 'Optional CMake Compilation Flags' + required: false + type: string + ctest_args: + description: 'Optional CTest Testing Flags' + required: false + type: string + fastdds_ref: + description: 'Branch or tag of Fast DDS repository (https://github.com/eProsima/Fast-DDS)' + required: true + + pull_request: + types: + - review_requested + paths-ignore: + - '**.md' + - '**.txt' + - '!**/CMakeLists.txt' + + schedule: + - cron: '0 1 * * *' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + label: ${{ inputs.label || 'fastdds-sanitizers-ci' }} + build_asan_fastdds: ${{ + inputs.run_asan_fastdds || + github.event_name == 'schedule' || + github.event_name == 'pull_request' }} + run_asan_fastdds: ${{ inputs.run_asan_fastdds || + github.event_name == 'schedule' || + github.event_name == 'pull_request' }} + colcon_meta: ${{ inputs.colcon_meta || '' }} + colcon_build_args: ${{ inputs.colcon_build_args || '' }} + colcon_test_args: ${{ inputs.colcon_test_args || '' }} + cmake_args: ${{ inputs.cmake_args || '' }} + ctest_args: ${{ inputs.ctest_args || '' }} + fastdds_ref: ${{ inputs.fastdds_ref || github.ref || 'master' }} + +jobs: + asan_fastdds: + if: ${{ ( + !contains(github.event.pull_request.labels.*.name, 'skip-ci') && + !contains(github.event.pull_request.labels.*.name, 'no-test') && + !contains(github.event.pull_request.labels.*.name, 'conflicts') && + github.env.build_asan_fastdds == 'true' + ) }} + runs-on: ubuntu-22.04 + + steps: + - name: Add ci-pending label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/add_labels@v0 + with: + labels: ci-pending + number: ${{ github.event.number }} + repo: eProsima/Fast-DDS + + # https://github.com/actions/runner-images/issues/9491 + - name: Fix kernel mmap rnd bits + run: sudo sysctl vm.mmap_rnd_bits=28 + + - name: Sync eProsima/Fast-DDS repository + uses: eProsima/eProsima-CI/external/checkout@v0 + with: + path: src/fastrtps + ref: ${{ env.fastdds_ref }} + + - name: Get minimum supported version of CMake + uses: eProsima/eProsima-CI/external/get-cmake@v0 + with: + cmakeVersion: '3.22.6' + + - name: Install apt packages + uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0 + with: + packages: curl grep libasio-dev libtinyxml2-dev python3 python3-pip software-properties-common wget + + - name: Install colcon + uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0 + + - name: Install Python dependencies + uses: eProsima/eProsima-CI/ubuntu/install_python_packages@v0 + with: + packages: vcstool xmlschema + + - name: Setup CCache + uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 + + - name: Fetch Fast DDS dependencies + uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 + with: + vcs_repos_file: ${{ github.workspace }}/src/fastrtps/fastrtps.repos + destination_workspace: src + skip_existing: 'true' + + - name: Fetch Fast DDS CI dependencies + uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 + with: + vcs_repos_file: ${{ github.workspace }}/src/fastrtps/.github/workflows/config/asan.repos + destination_workspace: src + skip_existing: 'true' + + - name: Select .meta file + id: select_meta + if: ${{ env.colcon_meta == '' }} + run: | + echo "colcon_meta=${{ github.workspace }}/src/fastrtps/.github/workflows/config/asan_colcon.meta" + + - name: Colcon build + continue-on-error: false + uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0 + with: + colcon_meta_file: ${{ env.colcon_meta }} + colcon_build_args: ${{ env.colcon_build_args }} + cmake_args: ${{ env.cmake_args }} + cmake_args_default: '' + cmake_build_type: 'Debug' + workspace: ${{ github.workspace }} + workspace_dependencies: '' + + - name: Colcon test + if: ${{ env.run_asan_fastdds }} + id: test + uses: eProsima/eProsima-CI/multiplatform/colcon_test@v0 + with: + colcon_test_args: ${{ env.colcon_test_args }} + colcon_test_args_default: '--event-handlers=console_direct+ --return-code-on-test-failure' + ctest_args: ${{ env.ctest_args }} + ctest_args_default: '--timeout 300 --label-exclude "xfail"' + packages_names: fastrtps + workspace: ${{ github.workspace }} + workspace_dependencies: '' + test_report_artifact: ${{ format('test_report_{0}_{1}', env.label, github.job) }} + + - name: Report sanitizer errors + if: ${{ env.run_asan_fastdds }} + run: | + bash src/fastrtps/.github/workflows/utils/specific_errors_filter.sh \ + "==ERROR:" \ + log/latest_test/fastrtps/stdout_stderr.log \ + _tmp_specific_error_file.log + + python3 src/fastrtps/.github/workflows/utils/log_parser.py \ + --log-file log/latest_test/fastrtps/stdout_stderr.log \ + --specific-error-file _tmp_specific_error_file.log \ + --output-file $GITHUB_STEP_SUMMARY --sanitizer asan