From 60ced8197ebf63b3817cc0223fe7563642b50bb7 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Sun, 22 Jun 2025 11:40:12 +0200 Subject: [PATCH] CI: Move Windows CI to a separate workflow Having the pull_request 'labeled' event trigger the main CI is much too impactful, since it cancels running jobs and does not start anything if the label is anything else than 'windows'. Let's go with a different approach and put the Windows CI job in a separate workflow. How this works: * Jobs are only run if the 'windows' label is present on the PR. * If a PR is opened or updated, existing jobs are canceled. * If a PR is (un)labeled, existing jobs are only canceled if the label was 'windows'. Other labels cause the job to be rescheduled. As far as I can see, there's no way to prevent the job from being rescheduled when labels other than 'windows' are being added or removed. However, by not canceling the existing Windows job, we can try to create a cache so the next run will be much quicker. --- .github/workflows/ci-windows.yml | 32 ++++++++++++++++++++++++++++ .github/workflows/ci.yml | 29 ++----------------------- .github/workflows/lagom-template.yml | 5 ----- 3 files changed, 34 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/ci-windows.yml diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml new file mode 100644 index 00000000000..7d00e7698ce --- /dev/null +++ b/.github/workflows/ci-windows.yml @@ -0,0 +1,32 @@ +name: CI + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + # Do not cancel in-progress runs if a labeling action took place (other than 'windows'). Otherwise, adding irrelevant + # labels causes existing runs to be canceled and a new (identical) run to be started. + cancel-in-progress: ${{ (github.event.action != 'labeled' && github.event.action != 'unlabeled') || github.event.label.name == 'windows' }} + +jobs: + CI: + # Only run this job if the PR has the 'windows' label. + if: | + github.repository == 'LadybirdBrowser/ladybird' + && contains(github.event.pull_request.labels.*.name, 'windows') + name: 'Windows, x86_64, Windows_SanitizerCI, ClangCL' + uses: ./.github/workflows/lagom-template.yml + with: + toolchain: 'ClangCL' + os_name: 'Windows' + runner_labels: '["windows-2025"]' + arch: 'x86_64' + build_preset: 'Windows_Sanitizer_CI' + clang_plugins: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92a1b8577c8..df29187b46d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,6 @@ name: CI -on: - push: - pull_request: - types: - - opened - - synchronize - - reopened - - labeled +on: [push, pull_request] concurrency: group: ${{ github.workflow }}-${{ github.head_ref || format('{0}-{1}', github.ref, github.run_number) }} @@ -16,12 +9,7 @@ concurrency: jobs: # CI matrix - runs the job in lagom-template.yml with different configurations. Lagom: - # Run the items in this matrix only if: - # 1. The repository is the Ladybird repository; and - # 2. If the event was a push event, or a PR event other than 'labeled', or the label name is 'windows' - if: | - github.repository == 'LadybirdBrowser/ladybird' - && (github.event_name != 'pull_request' || github.event.action != 'labeled' || github.event.label.name == 'windows') + if: github.repository == 'LadybirdBrowser/ladybird' name: ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} strategy: @@ -33,7 +21,6 @@ jobs: toolchain: ['GNU'] clang_plugins: [false] runner_labels: ['["blacksmith-16vcpu-ubuntu-2404"]'] - enabled: [true] include: - os_name: 'Linux' @@ -42,7 +29,6 @@ jobs: toolchain: 'Clang' clang_plugins: true runner_labels: '["blacksmith-16vcpu-ubuntu-2404"]' - enabled: true - os_name: 'macOS' arch: 'arm64' @@ -50,7 +36,6 @@ jobs: toolchain: 'Clang' clang_plugins: false runner_labels: '["macos-15", "self-hosted"]' - enabled: true - os_name: 'Linux' arch: 'x86_64' @@ -58,15 +43,6 @@ jobs: toolchain: 'Clang' clang_plugins: false runner_labels: '["blacksmith-16vcpu-ubuntu-2404"]' - enabled: true - - - os_name: 'Windows' - arch: 'x86_64' - build_preset: 'Windows_Sanitizer_CI' - toolchain: 'ClangCL' - clang_plugins: false - runner_labels: '["windows-2025"]' - enabled: ${{ contains(github.event.pull_request.labels.*.name, 'windows') }} uses: ./.github/workflows/lagom-template.yml with: @@ -76,4 +52,3 @@ jobs: arch: ${{ matrix.arch }} build_preset: ${{ matrix.build_preset }} clang_plugins: ${{ matrix.clang_plugins }} - enabled: ${{ matrix.enabled }} diff --git a/.github/workflows/lagom-template.yml b/.github/workflows/lagom-template.yml index 68ec4c8f454..62fac3d97e9 100644 --- a/.github/workflows/lagom-template.yml +++ b/.github/workflows/lagom-template.yml @@ -22,10 +22,6 @@ on: required: false type: boolean default: false - enabled: - required: false - type: boolean - default: true env: # runner.workspace = /home/runner/work/ladybird @@ -42,7 +38,6 @@ env: jobs: CI: - if: ${{ inputs.enabled }} runs-on: ${{ fromJSON(inputs.runner_labels) }} steps: