From d3a969c3044d7583ec93b32c15d68373f2d7b903 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sun, 17 Mar 2024 08:42:25 +0100 Subject: [PATCH] Pin CMake version and vm.mmap_rnd_bits in sanitizer workflows (#4558) (#4566) * 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 1074111fb6..3a5b677e3e 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.13.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.2' }} 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 0000000000..78eb1aa1ac --- /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 8c9830e368..e6c9b7b5c6 100644 --- a/.github/workflows/config/asan_colcon.meta +++ b/.github/workflows/config/asan_colcon.meta @@ -16,3 +16,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 e7f8a45e3f..341a32d0c2 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 4524598840..884ae321e7 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 0387d140d7..6414e02194 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 b90931be0c..33b63a8294 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 b7d915fdbd..91c5f4c936 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: |