Skip to content
Merged
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
69 changes: 52 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M

jobs:
ubuntu-build:
name: Ubuntu build and tests
Expand All @@ -22,65 +26,83 @@ jobs:
- name: Check out source
uses: actions/checkout@v4

- name: Restore compiler cache
uses: actions/cache@v4
with:
path: .ccache
key: ${{ runner.os }}-${{ github.job }}-ccache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-ccache-

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
ccache \
cmake \
ninja-build \
libx11-dev \
libssl-dev \
pkg-config \
zlib1g-dev

- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache

- name: Build
run: cmake --build build --parallel

- name: Test
run: ctest --test-dir build --output-on-failure

- name: Compiler cache stats
run: ccache --show-stats

fedora-build:
name: Fedora build and tests
runs-on: ubuntu-latest
container:
image: fedora:latest

steps:
- name: Install Git for checkout
run: dnf install -y git

- name: Check out source
uses: actions/checkout@v4

- name: Install dependencies
run: |
dnf install -y \
dnf install -y --setopt=install_weak_deps=False \
ccache \
cmake \
gcc-c++ \
git \
gtk3-devel \
libayatana-appindicator3-devel \
libX11-devel \
make \
ninja-build \
openssl-devel \
pkgconf-pkg-config \
rpm-build \
systemd-rpm-macros \
zlib-devel

- name: Validate RPM packaging skeleton
run: MWB_VALIDATE_RPM_BUILD=1 scripts/validate-rpm-packaging.sh
- name: Check out source
uses: actions/checkout@v4

- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
- name: Restore compiler cache
uses: actions/cache@v4
with:
path: .ccache
key: ${{ runner.os }}-${{ github.job }}-ccache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-ccache-

- name: Build
run: cmake --build build --parallel
- name: Validate RPM packaging, build, and tests
run: |
MWB_VALIDATE_RPM_BUILD=1 \
MWB_RPM_CMAKE_EXTRA_ARGS="-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" \
scripts/validate-rpm-packaging.sh

- name: Test
run: ctest --test-dir build --output-on-failure
- name: Compiler cache stats
run: ccache --show-stats

sanitizers:
name: ASan and UBSan
Expand All @@ -90,26 +112,39 @@ jobs:
- name: Check out source
uses: actions/checkout@v4

- name: Restore compiler cache
uses: actions/cache@v4
with:
path: .ccache
key: ${{ runner.os }}-${{ github.job }}-ccache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-ccache-

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
ccache \
cmake \
ninja-build \
libx11-dev \
libssl-dev \
pkg-config \
zlib1g-dev

- name: Configure
run: cmake -S . -B build-sanitize -DCMAKE_BUILD_TYPE=Debug -DMWB_ENABLE_SANITIZERS=ON
run: cmake -S . -B build-sanitize -G Ninja -DCMAKE_BUILD_TYPE=Debug -DMWB_ENABLE_SANITIZERS=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache

- name: Build
run: cmake --build build-sanitize --parallel

- name: Test
run: ctest --test-dir build-sanitize --output-on-failure

- name: Compiler cache stats
run: ccache --show-stats

static-checks:
name: Static checks
runs-on: ubuntu-latest
Expand Down
5 changes: 4 additions & 1 deletion packaging/rpm/inputflow.spec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ retain the mwb-client naming for compatibility.
%autosetup -n %{name}-%{version}

%build
%cmake -DMWB_BUILD_TRAY=ON
%cmake -DMWB_BUILD_TRAY=ON %{?mwb_cmake_extra_args}
%cmake_build

%install
Expand All @@ -52,6 +52,9 @@ install -Dpm0644 packaging/usr/lib/systemd/user/mwb-client.service %{buildroot}%
install -Dpm0644 packaging/usr/share/applications/inputflow.desktop %{buildroot}%{_datadir}/applications/inputflow.desktop
install -Dpm0644 assets/icons/inputflow-desktop.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/inputflow.svg

%check
ctest --test-dir %{_vpath_builddir} --output-on-failure

%pre
%sysusers_create %{_sysusersdir}/mwb-client.conf

Expand Down
8 changes: 7 additions & 1 deletion scripts/validate-rpm-packaging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ grep -Eq 'install -Dpm0755 mwb-desktop-ui\.sh .+%\{_libexecdir\}/inputflow/mwb-d
grep -Eq 'install -Dpm0755 scripts/inputflow-diagnostics-bundle\.sh .+%\{_libexecdir\}/inputflow/scripts/inputflow-diagnostics-bundle\.sh' "$spec_file" || fail "spec must install the diagnostics bundle executable"
grep -Eq 'install -Dpm0644 packaging/usr/share/applications/inputflow\.desktop .+%\{_datadir\}/applications/inputflow\.desktop' "$spec_file" || fail "spec must install the desktop entry"
grep -Eq 'install -Dpm0644 assets/icons/inputflow-desktop\.svg .+%\{_datadir\}/icons/hicolor/scalable/apps/inputflow\.svg' "$spec_file" || fail "spec must install the application icon"
grep -Eq '^%check$' "$spec_file" || fail "spec must run package build tests in %check"
grep -Eq 'ctest --test-dir .*\{_vpath_builddir\} --output-on-failure' "$spec_file" || fail "spec %check must run ctest"

if command -v desktop-file-validate >/dev/null 2>&1; then
run_quiet "desktop-file-validate" desktop-file-validate packaging/usr/share/applications/inputflow.desktop
Expand Down Expand Up @@ -142,7 +144,11 @@ if command -v rpmbuild >/dev/null 2>&1; then
--transform "s#^\\./#${package_name}-${package_version}/#" \
-czf "$topdir/SOURCES/${package_name}-${package_version}.tar.gz"

run_quiet "rpmbuild -bb" rpmbuild -bb --define "_topdir $topdir" "$spec_file"
rpm_args=(--define "_topdir $topdir")
if [[ -n "${MWB_RPM_CMAKE_EXTRA_ARGS:-}" ]]; then
rpm_args+=(--define "mwb_cmake_extra_args ${MWB_RPM_CMAKE_EXTRA_ARGS}")
fi
run_quiet "rpmbuild -bb" rpmbuild -bb "${rpm_args[@]}" "$spec_file"
fi
fi

Expand Down
Loading