From ee8313cda0e09e7a2099b0e7ddd3683481a86eee 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 a review is requested (#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 --- .github/workflows/address-sanitizers.yaml | 34 ++++++++++++++++++---- .github/workflows/documentation-tests.yaml | 16 ++++++++-- .github/workflows/mac-ci.yml | 8 +++-- .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 | 18 ++++++++++-- .github/workflows/ubuntu-ci.yml | 8 ++++- .github/workflows/windows-ci.yml | 8 +++-- 9 files changed, 100 insertions(+), 16 deletions(-) diff --git a/.github/workflows/address-sanitizers.yaml b/.github/workflows/address-sanitizers.yaml index 7df74cc4f7f..a4b311318fd 100644 --- a/.github/workflows/address-sanitizers.yaml +++ b/.github/workflows/address-sanitizers.yaml @@ -13,6 +13,8 @@ on: default: 'master' pull_request: + types: + - review_requested paths-ignore: - '**.md' - '**.txt' @@ -28,9 +30,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 @@ -38,6 +42,14 @@ jobs: FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }} 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 @@ -124,9 +136,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 @@ -135,6 +149,14 @@ jobs: DEFAULT_DISCOVERY_SERVER_BRANCH: ${{ github.event.inputs.discovery_server_branch || 'master' }} 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 543b973a504..402d39e00f6 100644 --- a/.github/workflows/documentation-tests.yaml +++ b/.github/workflows/documentation-tests.yaml @@ -9,6 +9,8 @@ on: default: 'master' pull_request: + types: + - review_requested paths-ignore: - '**.md' - '**.txt' @@ -24,11 +26,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 70c14a5bc19..69f34c3f044 100644 --- a/.github/workflows/mac-ci.yml +++ b/.github/workflows/mac-ci.yml @@ -25,6 +25,8 @@ on: required: true pull_request: + types: + - review_requested paths-ignore: - '**.md' - '**.txt' @@ -36,9 +38,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 884ae321e71..3807960499e 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 a2341d240af..66b86532f80 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 33b63a8294d..a6afd890dae 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 1dad33a9deb..b64852f73b8 100644 --- a/.github/workflows/thread-sanitizer.yaml +++ b/.github/workflows/thread-sanitizer.yaml @@ -16,6 +16,8 @@ on: type: string pull_request: + types: + - review_requested paths-ignore: - '**.md' - '**.txt' @@ -33,9 +35,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 @@ -48,6 +52,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 0ef3854c6b4..01861fccbc1 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -25,13 +25,15 @@ on: required: true pull_request: + types: + - review_requested paths-ignore: - '**.md' - '**.txt' - '!**/CMakeLists.txt' concurrency: - group: ${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: @@ -43,6 +45,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 ddfd279b529..0838b8fdde8 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -25,6 +25,8 @@ on: required: true pull_request: + types: + - review_requested paths-ignore: - '**.md' - '**.txt' @@ -36,9 +38,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 }}