From 0c439a09a7a74c84976747ddc06ccce2fcbeebe6 Mon Sep 17 00:00:00 2001 From: Eduardo Ponz Segrelles Date: Fri, 15 Mar 2024 18:03:03 +0100 Subject: [PATCH] [20542] Pin CMake version and vm.mmap_rnd_bits in sanitizer workflows (#4558) * Refs #20542: Fix CMake version in sanitizer workflows Signed-off-by: EduPonz * Refs #20542: Install correct version of Gtest Signed-off-by: EduPonz * fixup! Refs #20542: Fix CMake version in sanitizer workflows * Refs #20542: Set number of random bits for mmap to 28 Signed-off-by: EduPonz * Refs #20542: Fix asan_colcon.meta Signed-off-by: EduPonz * Refs #20542: Use CCache also for ASan DS Signed-off-by: EduPonz --------- Signed-off-by: EduPonz --- .github/workflows/address-sanitizers.yaml | 31 ++++++++++++++++++++--- .github/workflows/config/asan.repos | 5 ++++ .github/workflows/config/asan_colcon.meta | 11 +++++--- .github/workflows/config/tsan_colcon.meta | 5 ++++ .github/workflows/reusable-mac-ci.yml | 2 +- .github/workflows/reusable-ubuntu-ci.yml | 2 +- .github/workflows/reusable-windows-ci.yml | 2 +- .github/workflows/thread-sanitizer.yaml | 19 +++++++++++--- 8 files changed, 63 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/config/asan.repos diff --git a/.github/workflows/address-sanitizers.yaml b/.github/workflows/address-sanitizers.yaml index 0b54f5f4ef3..42185f549c7 100644 --- a/.github/workflows/address-sanitizers.yaml +++ b/.github/workflows/address-sanitizers.yaml @@ -19,7 +19,7 @@ on: - '**.md' - '**.txt' - '!**/CMakeLists.txt' - + schedule: - cron: '0 1 * * *' @@ -40,11 +40,20 @@ jobs: FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }} steps: + # https://github.com/actions/runner-images/issues/9491 + - name: Fix kernel mmap rnd bits + run: sudo sysctl vm.mmap_rnd_bits=28 + - 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' + - name: Setup CCache uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 @@ -75,10 +84,12 @@ jobs: cd ./src/fastrtps git checkout ${{ env.FASTDDS_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: ${{ github.workspace }}/src/fastrtps/.github/workflows/config/asan.repos + destination_workspace: src + skip_existing: 'true' - name: Build workspace run: | @@ -126,11 +137,23 @@ jobs: DEFAULT_DISCOVERY_SERVER_BRANCH: ${{ github.event.inputs.discovery_server_branch || 'master' }} steps: + # https://github.com/actions/runner-images/issues/9491 + - name: Fix kernel mmap rnd bits + run: sudo sysctl vm.mmap_rnd_bits=28 + - 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' + + - name: Setup CCache + uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 + - name: Install colcon uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0 diff --git a/.github/workflows/config/asan.repos b/.github/workflows/config/asan.repos new file mode 100644 index 00000000000..78eb1aa1ac4 --- /dev/null +++ b/.github/workflows/config/asan.repos @@ -0,0 +1,5 @@ +repositories: + googletest-distribution: + type: git + url: https://github.com/google/googletest.git + version: release-1.12.1 diff --git a/.github/workflows/config/asan_colcon.meta b/.github/workflows/config/asan_colcon.meta index 6f214f9578d..5ea0dad1d3d 100644 --- a/.github/workflows/config/asan_colcon.meta +++ b/.github/workflows/config/asan_colcon.meta @@ -12,8 +12,13 @@ names: - "-DFASTDDS_STATISTICS=ON" - "-DSANITIZER=Address" - "-DCMAKE_CXX_FLAGS='-Werror'" - discovery-server: cmake-args: - -"-DCMAKE_BUILD_TYPE=Debug" - -"-DSANITIZER=Address" + - "-DCMAKE_BUILD_TYPE=Debug" + - "-DSANITIZER=Address" + googletest-distribution: + cmake-args: + - "-Dgtest_force_shared_crt=ON" + - "-DBUILD_SHARED_LIBS=ON" + - "-DBUILD_GMOCK=ON" + diff --git a/.github/workflows/config/tsan_colcon.meta b/.github/workflows/config/tsan_colcon.meta index e7f8a45e3ff..341a32d0c23 100644 --- a/.github/workflows/config/tsan_colcon.meta +++ b/.github/workflows/config/tsan_colcon.meta @@ -16,3 +16,8 @@ names: - "-DFASTDDS_STATISTICS=ON" - "-DCMAKE_C_FLAGS='-fsanitize=thread -O2 -g -fno-omit-frame-pointer'" - "-DCMAKE_CXX_FLAGS='-fsanitize=thread -O2 -g -fno-omit-frame-pointer'" + googletest-distribution: + cmake-args: + - "-Dgtest_force_shared_crt=ON" + - "-DBUILD_SHARED_LIBS=ON" + - "-DBUILD_GMOCK=ON" diff --git a/.github/workflows/reusable-mac-ci.yml b/.github/workflows/reusable-mac-ci.yml index 45245988403..884ae321e71 100644 --- a/.github/workflows/reusable-mac-ci.yml +++ b/.github/workflows/reusable-mac-ci.yml @@ -55,7 +55,7 @@ jobs: python-version: '3.11' - name: Get minimum supported version of CMake - uses: lukka/get-cmake@latest + uses: eProsima/eProsima-CI/external/get-cmake@v0 with: cmakeVersion: '3.22.6' diff --git a/.github/workflows/reusable-ubuntu-ci.yml b/.github/workflows/reusable-ubuntu-ci.yml index fee4c5d2e84..d53fe2aae31 100644 --- a/.github/workflows/reusable-ubuntu-ci.yml +++ b/.github/workflows/reusable-ubuntu-ci.yml @@ -49,7 +49,7 @@ jobs: ref: ${{ inputs.fastdds-branch }} - name: Get minimum supported version of CMake - uses: lukka/get-cmake@latest + uses: eProsima/eProsima-CI/external/get-cmake@v0 with: cmakeVersion: '3.22.6' diff --git a/.github/workflows/reusable-windows-ci.yml b/.github/workflows/reusable-windows-ci.yml index b90931be0c4..33b63a8294d 100644 --- a/.github/workflows/reusable-windows-ci.yml +++ b/.github/workflows/reusable-windows-ci.yml @@ -49,7 +49,7 @@ jobs: ref: ${{ inputs.fastdds_branch }} - name: Get minimum supported version of CMake - uses: lukka/get-cmake@latest + uses: eProsima/eProsima-CI/external/get-cmake@v0 with: cmakeVersion: '3.22.6' diff --git a/.github/workflows/thread-sanitizer.yaml b/.github/workflows/thread-sanitizer.yaml index 8d0914e8b88..109f60888d4 100644 --- a/.github/workflows/thread-sanitizer.yaml +++ b/.github/workflows/thread-sanitizer.yaml @@ -25,7 +25,7 @@ on: schedule: - cron: '0 1 * * *' - + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -50,11 +50,20 @@ jobs: CXX: g++-12 steps: + # https://github.com/actions/runner-images/issues/9491 + - name: Fix kernel mmap rnd bits + run: sudo sysctl vm.mmap_rnd_bits=28 + - 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' + - name: Setup CCache uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 @@ -85,10 +94,12 @@ jobs: cd ./src/fastrtps git checkout ${{ env.FASTDDS_BRANCH }} - - name: Install GTest - uses: eProsima/eProsima-CI/ubuntu/install_gtest@v0 + - name: Fetch Fast DDS CI dependencies + uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 with: - version: release-1.11.0 + vcs_repos_file: ${{ github.workspace }}/src/fastrtps/.github/workflows/config/ci.repos + destination_workspace: src + skip_existing: 'true' - name: Build workspace run: |