From 596b9f439fd832bd3f877307d2e865283c9218a7 Mon Sep 17 00:00:00 2001 From: Eduardo Ponz Segrelles Date: Mon, 25 Mar 2024 11:08:17 +0100 Subject: [PATCH] Only run PRs CI when run-ci label is added (#4599) * Refs #20648: Only run PRs CI when run-ci label is added Signed-off-by: EduPonz * Refs #20648: Correctly add ci-pending label Signed-off-by: EduPonz * Refs #20648: Fix documentation trigger Signed-off-by: EduPonz * Refs #20648: Add ci-pending label in mac CI Signed-off-by: EduPonz * Refs #20648: Set eProsima-CI version to v0 on add and remove labels actions Signed-off-by: EduPonz * Refs #20648: Change Github workflows trigger to 'review_requested' Signed-off-by: EduPonz --------- Signed-off-by: EduPonz (cherry picked from commit d0a334b11633b8cbe2b68350a763a6b292183247) # Conflicts: # .github/workflows/address-sanitizers.yaml # .github/workflows/documentation-tests.yaml # .github/workflows/mac-ci.yml # .github/workflows/thread-sanitizer.yaml # .github/workflows/ubuntu-ci.yml # .github/workflows/windows-ci.yml --- .github/workflows/address-sanitizers.yaml | 37 ++++++++++++++++++---- .github/workflows/documentation-tests.yaml | 19 +++++++++-- .github/workflows/mac-ci.yml | 11 +++++-- .github/workflows/reusable-mac-ci.yml | 8 +++++ .github/workflows/reusable-ubuntu-ci.yml | 8 +++++ .github/workflows/reusable-windows-ci.yml | 8 +++++ .github/workflows/thread-sanitizer.yaml | 21 ++++++++++-- .github/workflows/ubuntu-ci.yml | 17 +++++++++- .github/workflows/windows-ci.yml | 11 +++++-- 9 files changed, 124 insertions(+), 16 deletions(-) diff --git a/.github/workflows/address-sanitizers.yaml b/.github/workflows/address-sanitizers.yaml index 56730530899..f227a1a3d1e 100644 --- a/.github/workflows/address-sanitizers.yaml +++ b/.github/workflows/address-sanitizers.yaml @@ -13,8 +13,13 @@ on: default: '2.10.x' pull_request: +<<<<<<< HEAD branches: - '2.10.x' +======= + types: + - review_requested +>>>>>>> d0a334b11 (Only run PRs CI when run-ci label is added (#4599)) paths-ignore: - '**.md' - '**.txt' @@ -27,9 +32,11 @@ 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')) }} + 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') + ) }} runs-on: ubuntu-22.04 @@ -37,6 +44,14 @@ jobs: FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || '2.10.x' }} 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 @@ -123,9 +138,11 @@ jobs: 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')) }} + 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') + ) }} runs-on: ubuntu-22.04 @@ -134,6 +151,14 @@ jobs: DEFAULT_DISCOVERY_SERVER_BRANCH: ${{ github.event.inputs.discovery_server_branch || 'v1.2.1' }} 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 diff --git a/.github/workflows/documentation-tests.yaml b/.github/workflows/documentation-tests.yaml index 69648b20366..61f0bbcdb90 100644 --- a/.github/workflows/documentation-tests.yaml +++ b/.github/workflows/documentation-tests.yaml @@ -9,8 +9,13 @@ on: default: '2.10.x' pull_request: +<<<<<<< HEAD branches: - '2.10.x' +======= + types: + - review_requested +>>>>>>> d0a334b11 (Only run PRs CI when run-ci label is added (#4599)) paths-ignore: - '**.md' - '**.txt' @@ -26,11 +31,21 @@ env: jobs: ubuntu-build-and-test-documentation: name: Documentation build and test - if: ${{ !(contains(github.event.pull_request.labels.*.name, 'skip-ci') || - contains(github.event.pull_request.labels.*.name, 'conflicts')) }} + if: ${{ ( + !contains(github.event.pull_request.labels.*.name, 'skip-ci') && + !contains(github.event.pull_request.labels.*.name, 'conflicts') + ) }} 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 + - name: Sync eProsima/Fast-DDS repository uses: eProsima/eProsima-CI/external/checkout@v0 with: diff --git a/.github/workflows/mac-ci.yml b/.github/workflows/mac-ci.yml index f5e33cd1f37..75b23622e26 100644 --- a/.github/workflows/mac-ci.yml +++ b/.github/workflows/mac-ci.yml @@ -25,8 +25,13 @@ on: required: true pull_request: +<<<<<<< HEAD branches: - '2.10.x' +======= + types: + - review_requested +>>>>>>> d0a334b11 (Only run PRs CI when run-ci label is added (#4599)) paths-ignore: - '**.md' - '**.txt' @@ -38,9 +43,11 @@ concurrency: jobs: mac-ci: + if: ${{ ( + !contains(github.event.pull_request.labels.*.name, 'skip-ci') && + !contains(github.event.pull_request.labels.*.name, 'conflicts') + ) }} uses: ./.github/workflows/reusable-mac-ci.yml - if: ${{ !(contains(github.event.pull_request.labels.*.name, 'skip-ci') || - contains(github.event.pull_request.labels.*.name, 'conflicts')) }} with: label: ${{ inputs.label || 'mac-ci' }} colcon-args: ${{ inputs.colcon-args }} diff --git a/.github/workflows/reusable-mac-ci.yml b/.github/workflows/reusable-mac-ci.yml index 50d3bb1dd4a..cbc4e97de6b 100644 --- a/.github/workflows/reusable-mac-ci.yml +++ b/.github/workflows/reusable-mac-ci.yml @@ -44,6 +44,14 @@ jobs: cmake-build-type: - 'RelWithDebInfo' 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 + - name: Sync eProsima/Fast-DDS repository uses: eProsima/eProsima-CI/external/checkout@v0 with: diff --git a/.github/workflows/reusable-ubuntu-ci.yml b/.github/workflows/reusable-ubuntu-ci.yml index 6414e02194f..31b76e07131 100644 --- a/.github/workflows/reusable-ubuntu-ci.yml +++ b/.github/workflows/reusable-ubuntu-ci.yml @@ -42,6 +42,14 @@ jobs: cmake-build-type: - 'RelWithDebInfo' 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 + - name: Sync eProsima/Fast-DDS repository uses: eProsima/eProsima-CI/external/checkout@v0 with: diff --git a/.github/workflows/reusable-windows-ci.yml b/.github/workflows/reusable-windows-ci.yml index 28feb91b9e4..2583c0586dc 100644 --- a/.github/workflows/reusable-windows-ci.yml +++ b/.github/workflows/reusable-windows-ci.yml @@ -41,6 +41,14 @@ jobs: - 'v141' - 'v142' 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 + - name: Sync eProsima/Fast-DDS repository uses: eProsima/eProsima-CI/external/checkout@v0 with: diff --git a/.github/workflows/thread-sanitizer.yaml b/.github/workflows/thread-sanitizer.yaml index c75859e3d0c..53638888e37 100644 --- a/.github/workflows/thread-sanitizer.yaml +++ b/.github/workflows/thread-sanitizer.yaml @@ -16,8 +16,13 @@ on: type: string pull_request: +<<<<<<< HEAD branches: - '2.10.x' +======= + types: + - review_requested +>>>>>>> d0a334b11 (Only run PRs CI when run-ci label is added (#4599)) paths-ignore: - '**.md' - '**.txt' @@ -32,9 +37,11 @@ jobs: ubuntu-sanitizer-run: name: Sanitizer Evaluation - 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')) }} + 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') + ) }} runs-on: ubuntu-22.04 @@ -47,6 +54,14 @@ jobs: CXX: g++-12 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 diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index c6f23a4bd4e..804dc9108b2 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -24,8 +24,19 @@ on: type: string required: true +<<<<<<< HEAD +======= + pull_request: + types: + - review_requested + paths-ignore: + - '**.md' + - '**.txt' + - '!**/CMakeLists.txt' + +>>>>>>> d0a334b11 (Only run PRs CI when run-ci label is added (#4599)) concurrency: - group: ${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: @@ -37,6 +48,10 @@ jobs: os-image: - 'ubuntu-22.04' + if: ${{ ( + !contains(github.event.pull_request.labels.*.name, 'skip-ci') && + !contains(github.event.pull_request.labels.*.name, 'conflicts') + ) }} uses: ./.github/workflows/reusable-ubuntu-ci.yml with: os-image: ${{ matrix.os-image }} diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 78a9301801b..445ad2427f0 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -25,8 +25,13 @@ on: required: true pull_request: +<<<<<<< HEAD branches: - '2.10.x' +======= + types: + - review_requested +>>>>>>> d0a334b11 (Only run PRs CI when run-ci label is added (#4599)) paths-ignore: - '**.md' - '**.txt' @@ -38,9 +43,11 @@ concurrency: jobs: windows-ci: + if: ${{ ( + !contains(github.event.pull_request.labels.*.name, 'skip-ci') && + !contains(github.event.pull_request.labels.*.name, 'conflicts') + ) }} uses: ./.github/workflows/reusable-windows-ci.yml - if: ${{ !(contains(github.event.pull_request.labels.*.name, 'skip-ci') || - contains(github.event.pull_request.labels.*.name, 'conflicts')) }} with: label: ${{ inputs.label || 'windows-ci' }} colcon-args: ${{ inputs.colcon-args }}