Skip to content

Commit 1d64c02

Browse files
committed
Add GTK4 to build matrix on GitHub actions
Add a gtk build matrix entry for GTK3 and GTK4. Included is a little bit of self-documenting of the dependencies to build on Linux. Part of #2714
1 parent 8c5fcdd commit 1d64c02

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ on:
2828
type: boolean
2929
required: false
3030
default: false
31+
gtk:
32+
description: "(Required on Linux only) GTK version to use (one of gtk3, gtk4)"
33+
type: string
34+
required: false
35+
default: ""
3136

3237
jobs:
3338
build:
@@ -40,9 +45,27 @@ jobs:
4045
lfs: false # lfs-pull is not necessary, the natives are re-build in each run
4146
- name: Install Linux requirements
4247
if: ${{ inputs.native == 'gtk.linux.x86_64'}}
48+
shell: bash
4349
run: |
50+
set -x
4451
sudo apt-get update -qq
45-
sudo apt-get install -qq -y libgtk-3-dev libgtk-4-dev freeglut3-dev webkit2gtk-driver
52+
# Required tools (GHA normally provides these in their base images)
53+
sudo apt-get install -qq -y build-essential git
54+
# GTK3 dependencies
55+
sudo apt-get install -qq -y libgtk-3-dev freeglut3-dev webkit2gtk-driver
56+
# GTK4 dependencies
57+
sudo apt-get install -qq -y libgtk-4-dev freeglut3-dev libwebkitgtk-6.0-4
58+
59+
- name: Disable AppArmor when testing WebKit on GTK4
60+
if: ${{ inputs.native == 'gtk.linux.x86_64' && inputs.gtk == 'gtk4' }}
61+
shell: bash
62+
run: |
63+
# WebKit for GTK4 uses bwrap and on Ubuntu 24.04 default settings are not working
64+
# so turn off apparmor. We are already running in a protected environment, so we
65+
# don't really need this extra level.
66+
sudo sysctl kernel.unprivileged_userns_clone=1
67+
sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0
68+
4669
- name: Pull large static Windows binaries
4770
if: ${{ inputs.native == 'win32.win32.x86_64'}}
4871
run: |
@@ -60,6 +83,7 @@ jobs:
6083
- name: Build
6184
env:
6285
GTK_XCFLAGS: '-Wno-deprecated-declarations'
86+
SWT_GTK4: "${{ inputs.gtk == 'gtk4' && '1' || '0' }}"
6387
run: >-
6488
${{ contains(inputs.native, 'linux') && 'xvfb-run' || '' }}
6589
mvn --batch-mode -V -U -e
@@ -71,10 +95,12 @@ jobs:
7195
--fail-at-end
7296
-DskipNativeTests=false
7397
-DfailIfNoTests=false
74-
${{ (inputs.runtodotests == false && contains(inputs.native, 'linux')) && '-DexcludedGroups=gtk3-todo' || '' }}
98+
${{ (inputs.runtodotests == false && inputs.gtk == 'gtk4') && '-DexcludedGroups=gtk4-todo' || '' }}
7599
clean install
76100
- name: Performance tests
77101
if: ${{ inputs.performance }}
102+
env:
103+
SWT_GTK4: "${{ inputs.gtk == 'gtk4' && '1' || '0' }}"
78104
working-directory: tests/org.eclipse.swt.tests
79105
run: >-
80106
${{ contains(inputs.native, 'linux') && 'xvfb-run' || '' }}
@@ -89,7 +115,7 @@ jobs:
89115
if: always()
90116
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
91117
with:
92-
name: test-results-${{ inputs.native }}-java${{ inputs.java }}
118+
name: test-results-${{ inputs.native }}-${{ inputs.gtk }}-java${{ inputs.java }}
93119
if-no-files-found: warn
94120
path: |
95121
${{ github.workspace }}/**/target/surefire-reports/*.xml

.github/workflows/maven.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# This is the main maven workflow for SWT.
22

33
# You can run this locally to test changes with the act command https://nektosact.com/
4-
# For example, to run all linux tests on Java 21:
5-
# act -j build-linux --matrix java:21 --artifact-server-path $PWD/.artifacts
4+
# For example, to run all GTK4 tests:
5+
# act -j build-linux --matrix java:21 --matrix gtk:gtk4 --artifact-server-path $PWD/.artifacts
66
# You may need to download runners on first run, act will ask but if you
77
# want the big runner there is no progress as it downloads, so you can pull it with
88
# docker directly:
@@ -20,9 +20,6 @@ on:
2020
branches: [ master ]
2121
types: [opened, reopened, synchronize, labeled]
2222

23-
env:
24-
SWT_GTK4: "${{ contains(github.event.pull_request.labels.*.name, 'gtk4') && '1' || '0' }}"
25-
2623
jobs:
2724
event_file:
2825
name: "Event File"
@@ -40,11 +37,13 @@ jobs:
4037
fail-fast: false
4138
matrix:
4239
java: ['21']
40+
gtk: [gtk3, gtk4]
4341
uses: ./.github/workflows/build.yml
4442
with:
4543
runner: ubuntu-latest
4644
java: ${{ matrix.java }}
4745
native: gtk.linux.x86_64
46+
gtk: ${{ matrix.gtk }}
4847
performance: ${{ contains(github.event.pull_request.labels.*.name, 'performance') }}
4948
runtodotests: ${{ contains(github.event.pull_request.labels.*.name, 'runtodotests') }}
5049

0 commit comments

Comments
 (0)