From 3c8b473790ce5dcf787a7c65a162f95b21cc48fd Mon Sep 17 00:00:00 2001 From: EduPonz Date: Fri, 15 Mar 2024 10:06:02 +0100 Subject: [PATCH] Refs #20542: Run ASan inside a container Signed-off-by: EduPonz --- .github/workflows/address-sanitizers.yaml | 104 ++++++++++++---------- 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/.github/workflows/address-sanitizers.yaml b/.github/workflows/address-sanitizers.yaml index 29fda1c18f5..6a2e518acc1 100644 --- a/.github/workflows/address-sanitizers.yaml +++ b/.github/workflows/address-sanitizers.yaml @@ -29,26 +29,23 @@ concurrency: jobs: asan-test: - if: ${{ !(contains(github.event.pull_request.labels.*.name, 'no-test') || contains(github.event.pull_request.labels.*.name, 'skip-ci') || contains(github.event.pull_request.labels.*.name, 'conflicts')) }} - runs-on: ubuntu-22.04 - - env: - FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }} + container: + image: ubuntu:22.04 + volumes: + - ${{ github.workspace }}:${{ github.workspace }} + env: + WORKDIR: ${{ github.workspace }} + FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }} steps: - 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: Get minimum supported version of CMake - uses: eProsima/eProsima-CI/external/get-cmake@v0 - with: - cmakeVersion: '3.22.6' + run: | + apt update + apt install -y curl grep libasio-dev libtinyxml2-dev python3 python3-pip software-properties-common wget git libssl-dev build-essential cmake - name: Install colcon uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0 @@ -62,38 +59,40 @@ jobs: uses: eProsima/eProsima-CI/ubuntu/get_file_from_repo@v0 with: source_repository: eProsima/Fast-DDS - source_repository_branch: ${{ env.FASTDDS_BRANCH }} + source_repository_branch: ${FASTDDS_BRANCH} file_name: fastrtps.repos - file_result: fastrtps.repos + file_result: ${WORKDIR}/fastrtps.repos - name: Fetch Fast DDS & dependencies uses: eProsima/eProsima-CI/ubuntu/vcs_import@v0 with: - vcs_repos_file: fastrtps.repos - destination_workspace: src + vcs_repos_file: ${WORKDIR}/fastrtps.repos + destination_workspace: ${WORKDIR}/src - name: Checkout Fast DDS branch run: | - cd ./src/fastrtps - git checkout ${{ env.FASTDDS_BRANCH }} + cd ${WORKDIR}/src/fastrtps + git checkout ${FASTDDS_BRANCH} - name: Fetch Fast DDS ASan 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 + vcs_repos_file: ${WORKDIR}/src/fastrtps/.github/workflows/config/asan.repos + destination_workspace: ${WORKDIR}/src skip_existing: 'true' - name: Build workspace run: | - cat src/fastrtps/.github/workflows/config/asan_colcon.meta + cd ${WORKDIR} + cat ${WORKDIR}/src/fastrtps/.github/workflows/config/asan_colcon.meta colcon build \ --event-handlers=console_direct+ \ - --metas src/fastrtps/.github/workflows/config/asan_colcon.meta + --metas ${WORKDIR}/src/fastrtps/.github/workflows/config/asan_colcon.meta - name: Run tests Fast DDS run: | - source install/setup.bash && \ + cd ${WORKDIR} + source ${WORKDIR}/install/setup.bash && \ colcon test \ --packages-select fastrtps \ --event-handlers=console_direct+ \ @@ -107,33 +106,37 @@ jobs: uses: actions/upload-artifact@v1 with: name: asan-logs - path: log/ + path: ${WORKDIR}/log/ if: always() - name: Report ASAN errors if: always() run: | + cd ${WORKDIR} 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 asan-discovery-server-test: - if: ${{ !(contains(github.event.pull_request.labels.*.name, 'no-test') || contains(github.event.pull_request.labels.*.name, 'skip-ci') || contains(github.event.pull_request.labels.*.name, 'conflicts')) }} runs-on: ubuntu-22.04 - - env: - FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }} - DEFAULT_DISCOVERY_SERVER_BRANCH: ${{ github.event.inputs.discovery_server_branch || 'master' }} + container: + image: ubuntu:22.04 + volumes: + - ${{ github.workspace }}:${{ github.workspace }} + env: + WORKDIR: ${{ github.workspace }} + FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }} + DEFAULT_DISCOVERY_SERVER_BRANCH: ${{ github.event.inputs.discovery_server_branch || 'master' }} steps: - 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 + run: | + apt update + apt install -y curl grep libasio-dev libtinyxml2-dev python3 python3-pip software-properties-common wget git libssl-dev build-essential cmake - name: Install colcon uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0 @@ -147,43 +150,47 @@ jobs: uses: eProsima/eProsima-CI/ubuntu/get_file_from_repo@v0 with: source_repository: eProsima/Fast-DDS - source_repository_branch: ${{ env.FASTDDS_BRANCH }} + source_repository_branch: ${FASTDDS_BRANCH} file_name: fastrtps.repos - file_result: fastrtps.repos + file_result: ${WORKDIR}/fastrtps.repos - name: Fetch Fast DDS & dependencies uses: eProsima/eProsima-CI/ubuntu/vcs_import@v0 with: - vcs_repos_file: fastrtps.repos - destination_workspace: src + vcs_repos_file: ${WORKDIR}/fastrtps.repos + destination_workspace: ${WORKDIR}/src - name: Checkout Fast DDS branch run: | - cd ./src/fastrtps - git checkout ${{ env.FASTDDS_BRANCH }} + cd ${WORKDIR}/src/fastrtps + git checkout ${FASTDDS_BRANCH} - name: Sync eProsima/Discovery-Server repository uses: actions/checkout@v4 with: - path: src/discovery_server + path: ${WORKDIR}/src/discovery_server repository: eProsima/Discovery-Server - ref: ${{ env.DEFAULT_DISCOVERY_SERVER_BRANCH }} + ref: ${DEFAULT_DISCOVERY_SERVER_BRANCH} - - name: Install GTest - uses: eProsima/eProsima-CI/ubuntu/install_gtest@v0 + - name: Fetch Fast DDS ASan dependencies + uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 with: - version: v1.12.1 + vcs_repos_file: ${WORKDIR}/src/fastrtps/.github/workflows/config/asan.repos + destination_workspace: ${WORKDIR}/src + skip_existing: 'true' - name: Build workspace run: | - cat src/fastrtps/.github/workflows/config/asan_colcon.meta + cd ${WORKDIR} + cat ${WORKDIR}/src/fastrtps/.github/workflows/config/asan_colcon.meta colcon build \ --event-handlers=console_direct+ \ - --metas src/fastrtps/.github/workflows/config/asan_colcon.meta + --metas ${WORKDIR}/src/fastrtps/.github/workflows/config/asan_colcon.meta - name: Run tests Fast DDS run: | - source install/setup.bash && \ + cd ${WORKDIR} + source ${WORKDIR}/install/setup.bash && \ colcon test \ --packages-select discovery-server \ --event-handlers=console_direct+ \ @@ -197,11 +204,12 @@ jobs: uses: actions/upload-artifact@v1 with: name: asan-ds-logs - path: log/ + path: ${WORKDIR}/log/ if: always() - name: Report ASAN errors if: always() run: | + cd ${WORKDIR} bash src/fastrtps/.github/workflows/utils/specific_errors_filter.sh "==ERROR:" log/latest_test/discovery-server/stdout_stderr.log _tmp_specific_error_file.log python3 src/fastrtps/.github/workflows/utils/log_parser.py --log-file log/latest_test/discovery-server/stdout_stderr.log --specific-error-file _tmp_specific_error_file.log --output-file $GITHUB_STEP_SUMMARY --sanitizer=asan