Merge pull request #1887 from whot/wip/warn-on-xwayland #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build tests | |
on: | |
release: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
build_release: | |
description: 'Build Release binaries' | |
required: false | |
type: boolean | |
# Set the build type here | |
env: | |
B_BUILD_TYPE: ${{ (inputs.build_release || github.event_name == 'release') && 'Release' || 'Debug' }} | |
DEBIAN_FRONTEND: noninteractive | |
jobs: | |
linux-build: | |
name: ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
container: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: ubuntu-20-04 | |
os: "ubuntu:20.04" | |
cc: "gcc" | |
cxx: "g++" | |
wayland: false | |
- name: ubuntu-22-04-clang | |
os: "ubuntu:22.04" | |
cc: "clang" | |
cxx: "clang++" | |
wayland: true | |
- name: ubuntu-22-04 | |
os: "ubuntu:22.04" | |
cc: "gcc" | |
cxx: "g++" | |
wayland: true | |
steps: | |
# Preparation steps | |
- name: Update image and install pre-reqs | |
run: | | |
apt-get update -y | |
apt-get dist-upgrade -y | |
apt-get install -y \ | |
cmake \ | |
g++ \ | |
clang \ | |
git \ | |
libavahi-compat-libdnssd-dev \ | |
libcurl4-openssl-dev \ | |
libice-dev \ | |
libsm-dev \ | |
libssl-dev \ | |
libxinerama-dev \ | |
libxrandr-dev \ | |
libxtst-dev \ | |
libxkbcommon-dev \ | |
libglib2.0-dev \ | |
ninja-build \ | |
qtdeclarative5-dev \ | |
qttools5-dev | |
- if: matrix.wayland | |
name: Install libei and libportal pre-reqs | |
run: | | |
apt-get install -y \ | |
ca-certificates \ | |
dbus \ | |
gettext \ | |
git \ | |
libgirepository1.0-dev \ | |
libglib2.0 \ | |
libgtk-3-dev \ | |
libprotobuf-c-dev \ | |
libsystemd-dev \ | |
meson \ | |
protobuf-c-compiler \ | |
protobuf-compiler \ | |
python3-attr \ | |
python3-dbusmock \ | |
python3-jinja2 \ | |
python3-pip \ | |
python3-pytest \ | |
python3-jinja2 \ | |
valac | |
# Code checkout steps | |
- name: Checkout input-leap | |
uses: actions/checkout@v4 | |
with: | |
path: input-leap | |
submodules: recursive | |
set-safe-directory: ${{ github.workspace }} | |
- name: Get libei v1.2.1 from freedesktop | |
# Manual checkout of libinput/libei ref 1.2.1 from https://gitlab.freedesktop.org | |
# because actions/checkout does not support gitlab | |
if: matrix.wayland | |
run: | | |
git clone --depth=1 --branch="$ref" --recurse-submodules -- \ | |
"https://gitlab.freedesktop.org/libinput/libei" libei | |
env: | |
ref: 1.2.1 | |
- name: Get libportal from upstream | |
uses: actions/checkout@v4 | |
if: matrix.wayland | |
with: | |
repository: flatpak/libportal | |
ref: main | |
path: libportal | |
- if: matrix.wayland | |
name: build libei from git tag | |
run: | | |
meson setup -Dprefix=/usr -Dtests=disabled -Dliboeffis=disabled -Ddocumentation=[] libei _libei_builddir | |
ninja -C _libei_builddir install | |
- if: matrix.wayland | |
name: build libportal | |
run: | | |
meson setup --prefix=/usr -Dbackend-gtk3=enabled -Ddocs=false libportal _libportal_builddir | |
ninja -C _libportal_builddir install | |
- name: Configure the build | |
run: | | |
cmake -DCMAKE_BUILD_TYPE="${B_BUILD_TYPE}" -S input-leap -B build \ | |
-DCMAKE_CXX_FLAGS:STRING="-Wall -Wextra -Wno-unused-parameter" \ | |
-DCMAKE_CXX_FLAGS_DEBUG:STRING="-g -Werror" \ | |
-DINPUTLEAP_BUILD_LIBEI:BOOL=${{ matrix.wayland }} \ | |
-DCMAKE_INSTALL_PREFIX=input-leap-${{ matrix.name }} | |
env: | |
VERBOSE: 1 | |
CC: ${{ matrix.cc }} | |
CXX: ${{ matrix.cxx }} | |
- name: Run the build | |
run: | | |
cmake --build build --parallel --target install | |
env: | |
VERBOSE: 1 | |
# Finally, test step! | |
- name: Run the tests | |
run: | | |
ctest --test-dir build --verbose | |
- name: Create Artifacts | |
run: tar -cf input-leap-${{matrix.name}}.tar.gz input-leap-${{matrix.name}} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: input-leap-${{matrix.name}} | |
path: input-leap-${{matrix.name}}.tar.gz | |
if-no-files-found: error | |
mac-build: | |
name: ${{ matrix.name}} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: macOS-x86_64 | |
os: macos-11 | |
qt-version: 5.15 | |
min-macOS-version: 10.9 | |
arch: 'x86_64' | |
- name: macOS-Universal | |
os: macos-12 | |
qt-version: 6.6 | |
min-macOS-version: 11 | |
qt-modules: qt5compat | |
arch: 'arm64;x86_64' | |
- name: macOS-Apple_Silicon | |
os: macos-14 | |
qt-version: 6.6 | |
min-macOS-version: 14 | |
qt-modules: qt5compat | |
arch: 'arm64' | |
env: | |
VERBOSE: 1 | |
TERM: xterm-256color | |
OpenSSL_Install_Path: "/Users/runner/openssl" | |
OpenSSL_Version: 3.2.0 | |
steps: | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{matrix.qt-version}} | |
modules: ${{matrix.qt-modules}} | |
cache: true | |
cache-key-prefix: macOS-${{matrix.os}}-Qt${{matrix.qt-version}} | |
- name: Setup the image | |
run: | | |
brew install ninja | |
- name: Cache OpenSSL Universal | |
id: cache-openssl | |
if: matrix.os == 'macos-12' | |
uses: actions/[email protected] | |
with: | |
path: ${{env.OpenSSL_Install_Path}} | |
key: macOS-${{matrix.os}}-ssl-${{matrix.arch}}-${{env.OpenSSL_Version}} | |
- name: Build OpenSSL Universal | |
if: ((steps.cache-openssl.outputs.cache-hit != 'true') && (matrix.os == 'macos-12')) | |
run: | | |
wget https://github.com/openssl/openssl/releases/download/openssl-${{env.OpenSSL_Version}}/openssl-${{env.OpenSSL_Version}}.tar.gz | |
tar -xf openssl-${{env.OpenSSL_Version}}.tar.gz | |
echo "#!/bin/bash | |
if [[ \$* == *-arch\ x86_64* ]] && ! [[ \$* == *-arch\ arm64* ]]; then | |
cc -arch arm64 \$@ | |
else | |
cc \$@ | |
fi" >> /Users/runner/cc_override | |
chmod a+x /Users/runner/cc_override | |
cat /Users/runner/cc_override | |
export MACOSX_DEPLOYMENT_TARGET=${{matrix.min-macOS-version}} | |
export CC=/Users/runner/cc_override | |
cd openssl-${{env.OpenSSL_Version}} | |
./configure no-asm darwin64-x86_64-cc --prefix=${{env.OpenSSL_Install_Path}} | |
make | |
make install | |
- uses: actions/checkout@v4 | |
with: | |
path: input-leap | |
submodules: recursive | |
- name: Setup the build | |
run: | | |
cmake -DCMAKE_BUILD_TYPE="${B_BUILD_TYPE}" -S input-leap -B build -G Ninja -DOpenSSL_ROOT=${{env.OpenSSL_Install_Path}} \ | |
-DCMAKE_OSX_SYSROOT=$(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET=${{matrix.min-macOS-version}} -DCMAKE_UNITY_BUILD=1 -DQT_DEFAULT_MAJOR_VERSION=$(echo ${{matrix.qt-version}} | cut -c -1) \ | |
-DCMAKE_OSX_ARCHITECTURES="${{matrix.arch}}" | |
- name: Run the build | |
run: | | |
cmake --build build --parallel | |
- uses: actions/upload-artifact@v4 | |
if: env.B_BUILD_TYPE == 'Release' | |
with: | |
name: ${{ matrix.os }}-installer | |
path: ./build/bundle/*.dmg | |
if-no-files-found: error | |
- name: Archive debug app | |
if: env.B_BUILD_TYPE != 'Release' | |
run: tar -czf InputLeap-${{matrix.name}}.tar.gz -C build/bundle InputLeap.app | |
- uses: actions/upload-artifact@v4 | |
if: env.B_BUILD_TYPE != 'Release' | |
with: | |
name: ${{ matrix.name }}-debug | |
path: ./InputLeap*.tar.gz | |
if-no-files-found: error | |
win-build: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Windows Qt5 | |
os: windows-2019 | |
qt-version: 5.15 | |
qt-major: 5 | |
- name: Windows Qt6 | |
os: windows-2022 | |
qt-version: 6.6 | |
qt-major: 6 | |
qt-modules: qt5compat | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: input-leap | |
submodules: recursive | |
- name: Download Bonjour SDK-like | |
id: bonjour | |
run: | | |
$ErrorActionPreference = "Stop" | |
New-Item -Force -ItemType Directory -Path .\deps | |
Invoke-WebRequest 'https://github.com/nelsonjchen/mDNSResponder/releases/download/v2019.05.08.1/x64_RelWithDebInfo.zip' -OutFile 'deps\BonjourSDKLike.zip' ; | |
Expand-Archive .\deps\BonjourSDKLike.zip -DestinationPath .\deps\BonjourSDKLike | |
Remove-Item deps\BonjourSDKLike.zip | |
"path=$env:GITHUB_WORKSPACE\deps\BonjourSDKLike" >> $env:GITHUB_OUTPUT | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{matrix.qt-version}} | |
modules: ${{matrix.qt-modules}} | |
cache: true | |
cache-key-prefix: windows-${{matrix.os}}-Qt${{matrix.qt-version}} | |
- name: Configure build system | |
# NB. use cmd here to set variables from VsDevCmd.bat | |
shell: cmd | |
run: | | |
call "%VS_PATH%\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 | |
cmake -S input-leap -B build -G "%CMAKE_GEN%" -A x64 -D CMAKE_BUILD_TYPE=%B_BUILD_TYPE% ^ | |
-DQT_DEFAULT_MAJOR_VERSION=${{matrix.qt-major}} ^ | |
-DDNSSD_LIB="%BONJOUR_SDK_HOME%\Lib\x64\dnssd.lib" -D CMAKE_INSTALL_PREFIX=input-leap-install | |
env: | |
VS_PATH: ${{ matrix.os == 'windows-2019' && '%ProgramFiles(x86)%\Microsoft Visual Studio\2019' || '%ProgramFiles%\Microsoft Visual Studio\2022' }} | |
CMAKE_GEN: ${{ matrix.os == 'windows-2019' && 'Visual Studio 16 2019' || 'Visual Studio 17 2022' }} | |
BONJOUR_SDK_HOME: ${{ steps.bonjour.outputs.path }} | |
- name: Run build system | |
run: | | |
cmake --build build --config $env:B_BUILD_TYPE --target install | |
- name: Create Archive | |
run: Compress-Archive -Path input-leap-install\* -DestinationPath ${{ env.B_BUILD_TYPE }}.zip | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-${{ env.B_BUILD_TYPE }} | |
path: ${{ env.B_BUILD_TYPE }}.zip | |
if-no-files-found: warn | |
# Only build & upload installer for release builds on windows-2022 | |
- name: Build the Installer | |
if: matrix.os == 'windows-2022' && env.B_BUILD_TYPE == 'Release' | |
run: | | |
& "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" /Qp .\build\installer-inno\input-leap.iss | |
- uses: actions/upload-artifact@v4 | |
if: matrix.os == 'windows-2022' && env.B_BUILD_TYPE == 'Release' | |
with: | |
name: windows-installer | |
path: .\build\installer-inno\bin | |
if-no-files-found: error |