Skip to content

Commit

Permalink
Refs #20648: Only run PRs CI when run-ci label is added
Browse files Browse the repository at this point in the history
Signed-off-by: EduPonz <[email protected]>
  • Loading branch information
EduPonz committed Mar 22, 2024
1 parent 7154a57 commit cfd6d9d
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 13 deletions.
60 changes: 54 additions & 6 deletions .github/workflows/address-sanitizers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
default: 'master'

pull_request:
types:
- labeled
paths-ignore:
- '**.md'
- '**.txt'
Expand All @@ -28,16 +30,39 @@ 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

env:
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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/mac-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ on:
required: true

pull_request:
types:
- labeled
paths-ignore:
- '**.md'
- '**.txt'
Expand All @@ -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 }}
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/reusable-mac-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/reusable-ubuntu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/reusable-windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
31 changes: 28 additions & 3 deletions .github/workflows/thread-sanitizer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ on:
type: string

pull_request:
types:
- labeled
paths-ignore:
- '**.md'
- '**.txt'
Expand All @@ -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

Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/ubuntu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ on:
required: true

pull_request:
types:
- labeled
paths-ignore:
- '**.md'
- '**.txt'
Expand All @@ -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 }}
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ on:
required: true

pull_request:
types:
- labeled
paths-ignore:
- '**.md'
- '**.txt'
Expand All @@ -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 }}
Expand Down

0 comments on commit cfd6d9d

Please sign in to comment.