From 4712005c6fbbdec9f4608be8328da1748db225f2 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sun, 17 Mar 2024 08:43:01 +0100 Subject: [PATCH] Pin CMake version and vm.mmap_rnd_bits in sanitizer workflows (#4558) (#4568) * Refs #20542: Fix CMake version in sanitizer workflows * Refs #20542: Install correct version of Gtest * fixup! Refs #20542: Fix CMake version in sanitizer workflows * Refs #20542: Set number of random bits for mmap to 28 * Refs #20542: Fix asan_colcon.meta * Refs #20542: Use CCache also for ASan DS --------- (cherry picked from commit 0c439a09a7a74c84976747ddc06ccce2fcbeebe6) Signed-off-by: EduPonz Co-authored-by: Eduardo Ponz Segrelles --- .github/workflows/address-sanitizers.yaml | 37 +++++++++++++++++++---- .github/workflows/config/asan.repos | 5 +++ .github/workflows/config/asan_colcon.meta | 5 +++ .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 | 17 +++++++++-- 8 files changed, 63 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/config/asan.repos diff --git a/.github/workflows/address-sanitizers.yaml b/.github/workflows/address-sanitizers.yaml index 2760ce027ab..56730530899 100644 --- a/.github/workflows/address-sanitizers.yaml +++ b/.github/workflows/address-sanitizers.yaml @@ -37,11 +37,20 @@ jobs: FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || '2.10.x' }} 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 @@ -72,10 +81,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: | @@ -123,11 +134,23 @@ jobs: DEFAULT_DISCOVERY_SERVER_BRANCH: ${{ github.event.inputs.discovery_server_branch || 'v1.2.1' }} 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 @@ -162,10 +185,12 @@ jobs: repository: eProsima/Discovery-Server ref: ${{ env.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: ${{ github.workspace }}/src/fastrtps/.github/workflows/config/asan.repos + destination_workspace: src + skip_existing: 'true' - name: Build workspace run: | 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 f3861032c74..2b6710ec7a9 100644 --- a/.github/workflows/config/asan_colcon.meta +++ b/.github/workflows/config/asan_colcon.meta @@ -17,3 +17,8 @@ names: cmake-args: - "-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 bfecf695cbe..fe81d592e79 100644 --- a/.github/workflows/config/tsan_colcon.meta +++ b/.github/workflows/config/tsan_colcon.meta @@ -17,3 +17,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 0ba82850cee..50d3bb1dd4a 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.16.3' diff --git a/.github/workflows/reusable-ubuntu-ci.yml b/.github/workflows/reusable-ubuntu-ci.yml index 0387d140d78..6414e02194f 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 8f607a95cf7..28feb91b9e4 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.16.3' diff --git a/.github/workflows/thread-sanitizer.yaml b/.github/workflows/thread-sanitizer.yaml index a0611f68189..c75859e3d0c 100644 --- a/.github/workflows/thread-sanitizer.yaml +++ b/.github/workflows/thread-sanitizer.yaml @@ -47,11 +47,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 @@ -82,10 +91,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: |