From cfd6d9d57d6687abb152eb5c3b6ea514e45dcdca Mon Sep 17 00:00:00 2001 From: EduPonz Date: Fri, 22 Mar 2024 11:17:28 +0100 Subject: [PATCH] Refs #20648: Only run PRs CI when run-ci label is added Signed-off-by: EduPonz --- .github/workflows/address-sanitizers.yaml | 60 ++++++++++++++++++++--- .github/workflows/mac-ci.yml | 12 ++++- .github/workflows/reusable-mac-ci.yml | 17 +++++++ .github/workflows/reusable-ubuntu-ci.yml | 17 +++++++ .github/workflows/reusable-windows-ci.yml | 17 +++++++ .github/workflows/thread-sanitizer.yaml | 31 ++++++++++-- .github/workflows/ubuntu-ci.yml | 10 ++++ .github/workflows/windows-ci.yml | 12 ++++- 8 files changed, 163 insertions(+), 13 deletions(-) diff --git a/.github/workflows/address-sanitizers.yaml b/.github/workflows/address-sanitizers.yaml index 7df74cc4f7f..0e027b4a0e7 100644 --- a/.github/workflows/address-sanitizers.yaml +++ b/.github/workflows/address-sanitizers.yaml @@ -13,6 +13,8 @@ on: default: 'master' pull_request: + types: + - labeled paths-ignore: - '**.md' - '**.txt' @@ -28,9 +30,15 @@ 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: ${{ ( + (github.event_name == 'workflow_dispatch') || + contains(github.event.pull_request.labels.*.name, 'run-ci') + ) && + ( + !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 +46,23 @@ jobs: FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }} steps: + - name: Remove run-ci label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + with: + labels: run-ci + number: ${{ github.event.number }} + repo: eProsima/Fast-DDS + fail_on_error: 'false' + + - name: Add ci-pending label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + 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 +149,15 @@ 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: ${{ ( + (github.event_name == 'workflow_dispatch') || + contains(github.event.pull_request.labels.*.name, 'run-ci') + ) && + ( + !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 +166,23 @@ jobs: DEFAULT_DISCOVERY_SERVER_BRANCH: ${{ github.event.inputs.discovery_server_branch || 'master' }} steps: + - name: Remove run-ci label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + with: + labels: run-ci + number: ${{ github.event.number }} + repo: eProsima/Fast-DDS + fail_on_error: 'false' + + - name: Add ci-pending label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + 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/mac-ci.yml b/.github/workflows/mac-ci.yml index 70c14a5bc19..bd140901705 100644 --- a/.github/workflows/mac-ci.yml +++ b/.github/workflows/mac-ci.yml @@ -25,6 +25,8 @@ on: required: true pull_request: + types: + - labeled paths-ignore: - '**.md' - '**.txt' @@ -36,9 +38,15 @@ concurrency: jobs: mac-ci: + if: ${{ ( + (github.event_name == 'workflow_dispatch') || + contains(github.event.pull_request.labels.*.name, 'run-ci') + ) && + ( + !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..68e93b846a5 100644 --- a/.github/workflows/reusable-mac-ci.yml +++ b/.github/workflows/reusable-mac-ci.yml @@ -44,6 +44,23 @@ jobs: cmake-build-type: - 'RelWithDebInfo' steps: + - name: Remove run-ci label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + with: + labels: run-ci + number: ${{ github.event.number }} + repo: eProsima/Fast-DDS + fail_on_error: 'false' + + - name: Add ci-pending label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + 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..13847f325b7 100644 --- a/.github/workflows/reusable-ubuntu-ci.yml +++ b/.github/workflows/reusable-ubuntu-ci.yml @@ -42,6 +42,23 @@ jobs: cmake-build-type: - 'RelWithDebInfo' steps: + - name: Remove run-ci label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + with: + labels: run-ci + number: ${{ github.event.number }} + repo: eProsima/Fast-DDS + fail_on_error: 'false' + + - name: Add ci-pending label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + 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..ed0b80f6039 100644 --- a/.github/workflows/reusable-windows-ci.yml +++ b/.github/workflows/reusable-windows-ci.yml @@ -41,6 +41,23 @@ jobs: - 'v141' - 'v142' steps: + - name: Remove run-ci label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + with: + labels: run-ci + number: ${{ github.event.number }} + repo: eProsima/Fast-DDS + fail_on_error: 'false' + + - name: Add ci-pending label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + 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..ef7e718786d 100644 --- a/.github/workflows/thread-sanitizer.yaml +++ b/.github/workflows/thread-sanitizer.yaml @@ -16,6 +16,8 @@ on: type: string pull_request: + types: + - labeled paths-ignore: - '**.md' - '**.txt' @@ -33,9 +35,15 @@ 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: ${{ ( + (github.event_name == 'workflow_dispatch') || + contains(github.event.pull_request.labels.*.name, 'run-ci') + ) && + ( + !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 +56,23 @@ jobs: CXX: g++-12 steps: + - name: Remove run-ci label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + with: + labels: run-ci + number: ${{ github.event.number }} + repo: eProsima/Fast-DDS + fail_on_error: 'false' + + - name: Add ci-pending label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/remove_labels@feature/labels + 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..b3a6a6f0e55 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -25,6 +25,8 @@ on: required: true pull_request: + types: + - labeled paths-ignore: - '**.md' - '**.txt' @@ -43,6 +45,14 @@ jobs: os-image: - 'ubuntu-22.04' + if: ${{ ( + (github.event_name == 'workflow_dispatch') || + contains(github.event.pull_request.labels.*.name, 'run-ci') + ) && + ( + !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..1b9ace96b8f 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -25,6 +25,8 @@ on: required: true pull_request: + types: + - labeled paths-ignore: - '**.md' - '**.txt' @@ -36,9 +38,15 @@ concurrency: jobs: windows-ci: + if: ${{ ( + (github.event_name == 'workflow_dispatch') || + contains(github.event.pull_request.labels.*.name, 'run-ci') + ) && + ( + !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 }}