Skip to content

Speed up CI builds (#16) #46

Speed up CI builds (#16)

Speed up CI builds (#16) #46

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
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
runs-on: ubuntu-latest
steps:
- 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 -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 dependencies
run: |
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: 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: 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: Compiler cache stats
run: ccache --show-stats
sanitizers:
name: ASan and UBSan
runs-on: ubuntu-latest
steps:
- 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 -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
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Check trailing whitespace
run: |
if git grep -nI '[[:blank:]]$' -- .; then
echo "Trailing whitespace found"
exit 1
fi
- name: Check shell syntax
run: |
bash -n mwb-desktop-ui.sh
bash -n scripts/inputflow-diagnostics-bundle.sh
bash -n scripts/validate-rpm-packaging.sh
- name: Validate RPM packaging skeleton
run: scripts/validate-rpm-packaging.sh