From 880d076e6158001161e098294c21d840e7392a8e Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Tue, 11 Nov 2025 13:25:30 -0500 Subject: [PATCH 1/2] Use simpler build matrix, split by OS Rather than a single matrix that covers all OSes, split them up so that enumerating different ones is a little easier. This has three benefits: 1. `matrix.exclude` is easier to write in this format 2. Tools like `act` work with simple string matrix dimensions (see new comment at top of maven.yml) 3. conditional execution on file name pattens are easier to implement (see subsequent PR on this topic) Part of https://github.com/eclipse-platform/eclipse.platform.swt/issues/2714 --- .github/workflows/maven.yml | 55 +++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 5752b36bc20..416eb3a5744 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,5 +1,13 @@ # This is the main maven workflow for SWT. +# You can run this locally to test changes with the act command https://nektosact.com/ +# For example, to run all linux tests on Java 21: +# act -j build-linux --matrix java:21 --artifact-server-path $PWD/.artifacts +# You may need to download runners on first run, act will ask but if you +# want the big runner there is no progress as it downloads, so you can pull it with +# docker directly: +# docker pull catthehacker/ubuntu:full-latest + name: SWT Matrix Build concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -25,19 +33,48 @@ jobs: with: name: Event File path: ${{ github.event_path }} - build: + + build-linux: + name: Build (Linux) + strategy: + fail-fast: false + matrix: + java: ['21'] + uses: ./.github/workflows/build.yml + with: + runner: ubuntu-latest + java: ${{ matrix.java }} + native: gtk.linux.x86_64 + performance: ${{ contains(github.event.pull_request.labels.*.name, 'performance') }} + + build-windows: + name: Build (Windows) + strategy: + fail-fast: false + matrix: + java: ['21'] + uses: ./.github/workflows/build.yml + with: + runner: windows-latest + java: ${{ matrix.java }} + native: win32.win32.x86_64 + + build-macos: + name: Build (macOS) strategy: fail-fast: false matrix: - java: [ '21' ] - config: - - { name: Linux, os: ubuntu-latest, native: gtk.linux.x86_64 } - - { name: Windows, os: windows-latest, native: win32.win32.x86_64 } - - { name: MacOS x86, os: macos-15-intel, native: cocoa.macosx.x86_64 } - - { name: MacOS ARM, os: macos-latest, native: cocoa.macosx.aarch64 } + java: ['21'] + native: [cocoa.macosx.x86_64, cocoa.macosx.aarch64] + runner: [macos-15-intel, macos-latest] + exclude: + - runner: macos-latest + native: cocoa.macosx.x86_64 + - runner: macos-15-intel + native: cocoa.macosx.aarch64 uses: ./.github/workflows/build.yml with: - runner: ${{ matrix.config.os }} + runner: ${{ matrix.runner }} java: ${{ matrix.java }} - native: ${{ matrix.config.native }} + native: ${{ matrix.native }} performance: ${{ contains(github.event.pull_request.labels.*.name, 'performance') }} From 73e542bc5d9edf1060808f1624129a932710fa61 Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Tue, 11 Nov 2025 13:44:58 -0500 Subject: [PATCH 2/2] Skip build and test on OSes that have no changes Many of the PRs on SWT are OS specific, this change only runs the build on OSes if there are changes that can affect that OS. This is going to be more important with #2714 because potentially a number of new jobs will be run per PR and avoiding some of the extra time waiting will be a benefit to all. The minor negative of skipping tests conditionally is that the **Test Results** summary comment will report less runs that base commit. Part of https://github.com/eclipse-platform/eclipse.platform.swt/issues/2714 --- .github/workflows/maven.yml | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 416eb3a5744..425bcb96c99 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -34,8 +34,56 @@ jobs: name: Event File path: ${{ github.event_path }} + changes: + name: Detect changed paths + runs-on: ubuntu-latest + outputs: + # Lint warnings are expected in this block + # https://github.com/dorny/paths-filter/issues/223#issuecomment-2463309889 + win32: ${{ steps.filter.outputs.win32 || 'false' }} + gtk: ${{ steps.filter.outputs.gtk || 'false' }} + cocoa: ${{ steps.filter.outputs.cocoa || 'false' }} + md: ${{ steps.filter.outputs.md || 'false' }} + other: ${{ steps.filter.outputs.other || 'false' }} + steps: + - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 + with: + fetch-depth: 0 # so base/ref SHAs are diffable + - name: Paths filter (PR/Push only) + if: github.event.pull_request.base + # dorney/paths-filter is out of date, so use this fork with + # a specific fix for missing predicate-quantifier in action's + # inputs + # https://github.com/dorny/paths-filter/pull/226#issuecomment-2805358761 + uses: petermetz/paths-filter@5ee2f5d4cf5d7bdd998a314a42da307e2ae1639d + id: filter + with: + predicate-quantifier: 'every' + filters: | + win32: + - '**/win32/**' + gtk: + - '**/gtk/**' + cocoa: + - '**/cocoa/**' + md: + - '**/*.md' + jenkins: + - 'Jenkinsfile' + # "other" = anything not matching the above buckets + other: + - '**' + - '!**/win32/**' + - '!**/gtk/**' + - '!**/cocoa/**' + - '!**/*.md' + - '!Jenkinsfile' + build-linux: name: Build (Linux) + needs: changes + # push => always; PR => run if gtk changed OR "other" changed (run-everything case) + if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.gtk == 'true' || needs.changes.outputs.other == 'true' }} strategy: fail-fast: false matrix: @@ -49,6 +97,9 @@ jobs: build-windows: name: Build (Windows) + needs: changes + # push => always; PR => run if win32 changed OR "other" changed (run-everything case) + if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.win32 == 'true' || needs.changes.outputs.other == 'true' }} strategy: fail-fast: false matrix: @@ -58,9 +109,13 @@ jobs: runner: windows-latest java: ${{ matrix.java }} native: win32.win32.x86_64 + performance: ${{ contains(github.event.pull_request.labels.*.name, 'performance') }} build-macos: name: Build (macOS) + needs: changes + # push => always; PR => run if cocoa changed OR "other" changed (run-everything case) + if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.cocoa == 'true' || needs.changes.outputs.other == 'true' }} strategy: fail-fast: false matrix: