Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 75 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,45 @@ on:
type: boolean
required: false
default: false
gtk:
description: |
(Required on Linux only) GTK version to use (one of gtk3, gtk4)

Controls the SWT_GTK4 environemnt variable.
type: string
required: false
default: ""
gdk_backend:
description: |
(Required on Linux only) GDK_BACKEND to use (one of x11, wayland)

Sets the GDK_BACKEND to x11 or wayland. The compositor has to support
the GDK_BACKEND to be useful. For example, setting GDK_BACKEND to
x11 and compositor to wayland will lead to no available handles
due to no x11 display being available.
type: string
required: false
default: ""
compositor:
description: |
(Required on Linux only) Compositor type to use (one of x11, xwayland, wayland)

x11: Uses a "pure" x11 compositor with no wayland display running, using Xvfb.
This is the most common setup for older linux distros that don't come
with wayland, and for some lightweight distro that only have x11.
xwayland: Runs weston for Wayland display and Xwayland for x11 display
simulatanously. Xwayland provides an x11 display and draws that on
the Wayland compositor.
This is the most common setup for most current linux distros, as of this
writing. Xwayland provides a way for apps that have nor updated to Wayland
to continue to run. There are some signs that Xwayland may be removed
in future distros.
wayland: Uses a "pure" wayland compositor with no x11 display running, using
weston.
This is likely to be the future default setup of most distros.
type: string
required: false
default: ""

jobs:
build:
Expand All @@ -40,9 +79,29 @@ jobs:
lfs: false # lfs-pull is not necessary, the natives are re-build in each run
- name: Install Linux requirements
if: ${{ inputs.native == 'gtk.linux.x86_64'}}
shell: bash
run: |
set -x
sudo apt-get update -qq
sudo apt-get install -qq -y libgtk-3-dev libgtk-4-dev freeglut3-dev webkit2gtk-driver
# Required tools (GHA normally provides these in their base images)
sudo apt-get install -qq -y build-essential git
# GTK3 dependencies
sudo apt-get install -qq -y libgtk-3-dev freeglut3-dev webkit2gtk-driver
# GTK4 dependencies
sudo apt-get install -qq -y libgtk-4-dev freeglut3-dev libwebkitgtk-6.0-4
# Wayland runtimes, xwayland-run depends on all the needed packages
sudo apt-get install -qq -y xwayland-run

- name: Disable AppArmor when testing WebKit on GTK4
if: ${{ inputs.native == 'gtk.linux.x86_64' && inputs.gtk == 'gtk4' }}
shell: bash
run: |
# WebKit for GTK4 uses bwrap and on Ubuntu 24.04 default settings are not working
# so turn off apparmor. We are already running in a protected environment, so we
# don't really need this extra level.
sudo sysctl kernel.unprivileged_userns_clone=1
sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0

- name: Pull large static Windows binaries
if: ${{ inputs.native == 'win32.win32.x86_64'}}
run: |
Expand All @@ -60,8 +119,12 @@ jobs:
- name: Build
env:
GTK_XCFLAGS: '-Wno-deprecated-declarations'
SWT_GTK4: "${{ inputs.gtk == 'gtk4' && '1' || '0' }}"
GDK_BACKEND: "${{ inputs.gdk_backend }}"
run: >-
${{ contains(inputs.native, 'linux') && 'xvfb-run' || '' }}
${{ inputs.compositor == 'x11' && 'xvfb-run' || '' }}
${{ inputs.compositor == 'wayland' && 'wlheadless-run --width 1920 --height 1080 -- ' || '' }}
${{ inputs.compositor == 'xwayland' && 'wlheadless-run --width 1920 --height 1080 -- xwayland-run -geometry 1920x1080 -- ' || '' }}
mvn --batch-mode -V -U -e
--threads 1C
-DforkCount=1
Expand All @@ -71,13 +134,20 @@ jobs:
--fail-at-end
-DskipNativeTests=false
-DfailIfNoTests=false
${{ (inputs.runtodotests == false && contains(inputs.native, 'linux')) && '-DexcludedGroups=gtk3-todo' || '' }}
${{ (inputs.runtodotests == false && inputs.gtk =='gtk4' && inputs.gdk_backend == 'wayland') && '-DexcludedGroups=gtk4-todo,gtk4-wayland-todo' || '' }}
${{ (inputs.runtodotests == false && inputs.gtk =='gtk4' && inputs.gdk_backend == 'x11') && '-DexcludedGroups=gtk4-todo' || '' }}
${{ (inputs.runtodotests == false && inputs.gtk =='gtk3' && inputs.gdk_backend == 'wayland') && '-DexcludedGroups=gtk3-wayland-todo' || '' }}
clean install
- name: Performance tests
if: ${{ inputs.performance }}
env:
SWT_GTK4: "${{ inputs.gtk == 'gtk4' && '1' || '0' }}"
GDK_BACKEND: "${{ inputs.gdk_backend }}"
working-directory: tests/org.eclipse.swt.tests
run: >-
${{ contains(inputs.native, 'linux') && 'xvfb-run' || '' }}
${{ inputs.compositor == 'x11' && 'xvfb-run' || '' }}
${{ inputs.compositor == 'wayland' && 'wlheadless-run --width 1920 --height 1080 -- ' || '' }}
${{ inputs.compositor == 'xwayland' && 'wlheadless-run --width 1920 --height 1080 -- xwayland-run -geometry 1920x1080 -- ' || '' }}
mvn --batch-mode -V -U -e
-DforkCount=1
--fail-at-end
Expand All @@ -89,7 +159,7 @@ jobs:
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: test-results-${{ inputs.native }}-java${{ inputs.java }}
name: test-results-${{ inputs.native }}-${{ inputs.gtk }}-${{ inputs.gdk_backend }}-${{ inputs.compositor }}-java${{ inputs.java }}
if-no-files-found: warn
path: |
${{ github.workspace }}/**/target/surefire-reports/*.xml
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 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
# For example, to run all GTK4 tests:
# act -j build-linux --matrix java:21 --matrix gtk:gtk4 --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:
Expand All @@ -20,9 +20,6 @@ on:
branches: [ master ]
types: [opened, reopened, synchronize, labeled]

env:
SWT_GTK4: "${{ contains(github.event.pull_request.labels.*.name, 'gtk4') && '1' || '0' }}"

jobs:
event_file:
name: "Event File"
Expand All @@ -40,11 +37,22 @@ jobs:
fail-fast: false
matrix:
java: ['21']
gtk: [gtk3, gtk4]
gdk_backend: [x11, wayland]
compositor: [x11, xwayland, wayland]
exclude:
- gdk_backend: x11
compositor: wayland
- gdk_backend: wayland
compositor: x11
uses: ./.github/workflows/build.yml
with:
runner: ubuntu-latest
java: ${{ matrix.java }}
native: gtk.linux.x86_64
gtk: ${{ matrix.gtk }}
gdk_backend: ${{ matrix.gdk_backend }}
compositor: ${{ matrix.compositor }}
performance: ${{ contains(github.event.pull_request.labels.*.name, 'performance') }}
runtodotests: ${{ contains(github.event.pull_request.labels.*.name, 'runtodotests') }}

Expand Down
Loading