Skip to content

Merge pull request #2034 from p12tic/update-readme #59

Merge pull request #2034 from p12tic/update-readme

Merge pull request #2034 from p12tic/update-readme #59

Workflow file for this run

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-22-04-clang
os: "ubuntu:22.04"
cc: "clang"
cxx: "clang++"
wayland: none
- name: ubuntu-22-04
os: "ubuntu:22.04"
cc: "gcc"
cxx: "g++"
wayland: none
- name: ubuntu-24-04
os: "ubuntu:24.04"
cc: "gcc"
cxx: "g++"
wayland: dist
- name: ubuntu-24-10
os: "ubuntu:24.10"
cc: "gcc"
cxx: "g++"
wayland: dist
- name: debian-12
os: "debian:bookworm"
cc: "gcc"
cxx: "g++"
wayland: none
- name: debian-12-latest-libei
os: "debian:bookworm"
cc: "gcc"
cxx: "g++"
wayland: latest
steps:
- name: Update and install packages
run: |
apt-get update -y
apt-get dist-upgrade -y
apt-get install -y \
cmake \
g++ \
clang \
git \
libavahi-compat-libdnssd-dev \
libgtest-dev \
libgl-dev \
libgmock-dev \
libice-dev \
libsm-dev \
libssl-dev \
libxinerama-dev \
libxrandr-dev \
libxtst-dev \
libxkbcommon-dev \
libglib2.0-dev \
ninja-build \
qt6-base-dev \
qt6-l10n-tools \
qt6-tools-dev-tools \
qt6-tools-dev
- if: env.B_BUILD_TYPE == 'Release'
name: Install release installer build packages
run: |
apt-get install -y \
debhelper \
devscripts \
xvfb
- if: matrix.wayland == 'latest'
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
- if: matrix.wayland == 'dist'
name: Install libei and libportal distribution packages
run: |
apt-get install -y \
libei-dev \
libportal-dev
# Code checkout steps
- name: Checkout input-leap
uses: actions/checkout@v4
with:
path: input-leap
submodules: recursive
set-safe-directory: ${{ github.workspace }}
- if: matrix.wayland == 'latest'
name: Get libei v1.3.0 from freedesktop
# Manual checkout of libinput/libei ref 1.3.0 from https://gitlab.freedesktop.org
# because actions/checkout does not support gitlab
run: |
git clone --depth=1 --branch="$ref" --recurse-submodules -- \
"https://gitlab.freedesktop.org/libinput/libei" libei
env:
ref: 1.3.0
- if: matrix.wayland == 'latest'
name: Get libportal from upstream
uses: actions/checkout@v4
with:
repository: flatpak/libportal
ref: main
path: libportal
- if: matrix.wayland == 'latest'
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 == 'latest'
name: build libportal
run: |
meson setup --prefix=/usr -Dbackend-gtk3=enabled -Ddocs=false libportal _libportal_builddir
ninja -C _libportal_builddir install
- name: Run build
if: env.B_BUILD_TYPE != 'Release'
run: |
cmake -DCMAKE_BUILD_TYPE="${B_BUILD_TYPE}" -S input-leap -B build -G Ninja \
-DCMAKE_CXX_FLAGS:STRING="-Wall -Wextra -Wno-unused-parameter" \
-DCMAKE_CXX_FLAGS_DEBUG:STRING="-g -Werror" \
-DCMAKE_UNITY_BUILD=1 \
-DINPUTLEAP_BUILD_LIBEI:BOOL=${{ (matrix.wayland != 'none') && '1' || '0' }} \
-DCMAKE_INSTALL_PREFIX=input-leap-${{ matrix.name }}
cmake --build build --parallel --target install
env:
VERBOSE: 1
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
- name: Run the tests
if: env.B_BUILD_TYPE != 'Release'
run: |
ctest --test-dir build --verbose
- name: Create Artifacts
if: env.B_BUILD_TYPE != 'Release'
run: tar -cf input-leap-${{matrix.name}}.tar.gz input-leap-${{matrix.name}}
- name: Upload Artifacts
if: env.B_BUILD_TYPE != 'Release'
uses: actions/upload-artifact@v4
with:
name: input-leap-${{matrix.name}}
path: input-leap-${{matrix.name}}.tar.gz
if-no-files-found: error
- name: Build Debian package
if: env.B_BUILD_TYPE == 'Release'
run: |
cd input-leap
cp -r dist/debian debian
if [ "${{ matrix.wayland }}" = "dist" ]; then
sed -i -e 's/-DINPUTLEAP_BUILD_LIBEI=0/-DINPUTLEAP_BUILD_LIBEI=1/g' debian/rules
fi
debuild -us -uc
- name: Upload Artifacts
if: env.B_BUILD_TYPE == 'Release'
uses: actions/upload-artifact@v4
with:
name: input-leap-deb-${{matrix.name}}
path: input-leap_*.deb
if-no-files-found: error
linux-rpm:
name: ${{ matrix.os }}
runs-on: ubuntu-latest
container: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["fedora:40"]
include:
- installer: dnf install -y
rpm_tag: fedora
steps:
- name: Install extra build dependencies
run: ${{ matrix.installer }} git rpm-build ninja-build
# submodules require git to be installed
- name: Check out repository
uses: actions/checkout@v4
with:
path: input-leap
submodules: recursive
set-safe-directory: ${{ github.workspace }}
- name: Install dependencies
run: |
# Replace foo >= x with "foo >= x", print only what follows ^BuildRequires
sed -n 's/\(\S\+ [<>=]\+ [0-9]\+.\?[0-9]\?\)/"\1"/;{s/^BuildRequires: //p}' input-leap/dist/rpm/input-leap.spec.in | xargs ${{ matrix.installer }}
- name: prep tree
run: |
cmake -S input-leap -GNinja -B build -DCMAKE_UNITY_BUILD=1 -DINPUTLEAP_USE_EXTERNAL_GTEST=True
ninja -C build package_source
- name: create target directory
run: mkdir rpms
- name: build SRPM package
run: |
rpmbuild -D "_sourcedir $PWD/build" -D "_srcrpmdir ${PWD}/rpms" -bs build/rpm/input-leap.spec
- name: build RPM package
run: |
rpmbuild -D "_sourcedir $PWD/build" -D "_rpmdir $PWD/rpms" -bb build/rpm/input-leap.spec
- name: Archive RPM package
uses: actions/upload-artifact@v4
with:
name: input-leap-rpms-${{ matrix.rpm_tag }}
path: |
rpms/**/*.rpm
mac-build:
name: ${{ matrix.name}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: macOS-x86_64
os: macos-12
qt-version: 6.6
min-macOS-version: 10.15
arch: 'x86_64'
- name: macOS-Universal
os: macos-12
qt-version: 6.6
min-macOS-version: 11
arch: 'arm64;x86_64'
- name: macOS-Apple_Silicon
os: macos-14
qt-version: 6.6
min-macOS-version: 14
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@v4
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 \
-DCMAKE_UNITY_BUILD=1 \
-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 \
-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.name }}-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
os: windows-2022
qt-version: 6.6
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@v4
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
run: |
New-Item -Force -ItemType Directory -Path .\build | Out-Null
cd build
cmake -S ..\input-leap -G "$env:CMAKE_GEN" -A x64 -D CMAKE_BUILD_TYPE=$B_BUILD_TYPE `
-DDNSSD_LIB="$env: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 build\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
- name: Build the Installer
if: 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: env.B_BUILD_TYPE == 'Release'
with:
name: windows-installer-${{ matrix.name }}
path: .\build\installer-inno\bin
if-no-files-found: error
freebsd-build:
name: freebsd-14-1
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Build on FreeBSD 14.1
id: test
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
pkg install -y \
cmake-core \
pkgconf \
git \
avahi-libdns \
libsm \
libxinerama \
libxrandr \
libxtst \
libxkbcommon \
glib \
ninja \
qt6-base \
qt6-tools \
qt6-declarative
run: |
git config --global --add safe.directory /home/runner/work/input-leap/input-leap
git submodule update --init --recursive
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_UNITY_BUILD=1 -DINPUTLEAP_BUILD_INSTALLER=OFF ..
cmake --build . --parallel
flatpak:
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:kde-6.7
options: --privileged
steps:
# submodules require git to be installed
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: recursive
- run: git config --global protocol.file.allow always
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
name: "Build"
with:
bundle: input-leap.flatpak
manifest-path: dist/flatpak/io.github.input_leap.InputLeap.yml
cache-key: flatpak-builder-${{ github.sha }}
upload-artifact: false
- uses: actions/upload-artifact@v4
if: env.B_BUILD_TYPE == 'Release'
with:
name: input-leap-flatpak-x86_64
path: input-leap.flatpak
if-no-files-found: error