| 1 |
name: linux |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
- 'releases/**' |
| 8 |
pull_request: |
| 9 |
branches: |
| 10 |
- master |
| 11 |
- 'releases/**' |
| 12 |
|
| 13 |
# Set permissions at the job level. |
| 14 |
permissions: {} |
| 15 |
|
| 16 |
jobs: |
| 17 |
linux: |
| 18 |
runs-on: ubuntu-22.04 |
| 19 |
permissions: |
| 20 |
contents: read |
| 21 |
strategy: |
| 22 |
matrix: |
| 23 |
compiler: [clang, gcc] |
| 24 |
sanitizers: ['sanitizers', 'no sanitizer'] |
| 25 |
exclude: |
| 26 |
- compiler: clang |
| 27 |
sanitizers: sanitizers |
| 28 |
steps: |
| 29 |
- uses: actions/checkout@v5 |
| 30 |
with: |
| 31 |
persist-credentials: false |
| 32 |
- uses: actions/setup-python@v5 |
| 33 |
with: |
| 34 |
python-version: '3.12' |
| 35 |
- name: Install dependencies |
| 36 |
run: | |
| 37 |
# Jinja2 is needed for merge-modes tests |
| 38 |
python -m pip install --upgrade meson PyYAML ruff Jinja2 |
| 39 |
sudo apt update |
| 40 |
sudo apt install -y \ |
| 41 |
locales tzdata \ |
| 42 |
doxygen libxcb-xkb-dev valgrind ninja-build \ |
| 43 |
libwayland-dev wayland-protocols bison graphviz libicu-dev \ |
| 44 |
${{ matrix.sanitizers == 'sanitizers' && 'libasan8 libubsan1' || '' }} |
| 45 |
# Generate locale for tests |
| 46 |
sudo locale-gen fr_FR.UTF-8 |
| 47 |
- name: Install xkeyboard-config |
| 48 |
run: | |
| 49 |
# Install master version of xkeyboard-config, in order to ensure |
| 50 |
# its latest version works well with xkbcommon. |
| 51 |
# HACK: We use meson to install, while it would be cleaner |
| 52 |
# to create a proper package to install or use some PPA. |
| 53 |
pushd ~ |
| 54 |
git clone --depth=1 https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config.git |
| 55 |
pushd "xkeyboard-config" |
| 56 |
BUILDDIR=build |
| 57 |
# xkeyboard-config 2.45+ uses symlinks for legacy unversioned files, |
| 58 |
# but meson cannot overwrite < 2.45 which used regular files and directories. |
| 59 |
rm /usr/share/pkgconfig/xkeyboard-config.pc |
| 60 |
rm -r /usr/share/X11/xkb |
| 61 |
meson setup $BUILDDIR -Dprefix=/usr |
| 62 |
meson install -C $BUILDDIR |
| 63 |
popd |
| 64 |
popd |
| 65 |
- name: Create custom locale for testing |
| 66 |
run: | |
| 67 |
# The locale name must be kept in sync with the Compose test |
| 68 |
sudo localedef -i en_US -f UTF-8 xx_YY.UTF-8 |
| 69 |
- name: Setup |
| 70 |
run: | |
| 71 |
# -gdwarf-4 - see https://github.com/llvm/llvm-project/issues/56550. |
| 72 |
CFLAGS='-gdwarf-4 -fno-omit-frame-pointer' \ |
| 73 |
meson setup -Denable-docs=true -Denable-cool-uris=true \ |
| 74 |
$MESON_EXTRA_FLAGS \ |
| 75 |
build |
| 76 |
env: |
| 77 |
CC: ${{ matrix.compiler }} |
| 78 |
# Use sanitizers only if not using Valgrind |
| 79 |
MESON_EXTRA_FLAGS: ${{ matrix.sanitizers == 'sanitizers' && '-Db_sanitize=address,undefined' || '' }} |
| 80 |
- name: Build |
| 81 |
run: | |
| 82 |
meson compile -C build |
| 83 |
- name: Test |
| 84 |
# Use a specific non-US locale |
| 85 |
run: |
| 86 |
LC_ALL=fr_FR.UTF-8 meson test -C build --print-errorlogs |
| 87 |
- name: Test with valgrind |
| 88 |
if: matrix.sanitizers != 'sanitizers' |
| 89 |
# Use a specific non-US locale |
| 90 |
run: | |
| 91 |
LC_ALL=fr_FR.UTF-8 meson test -C build --print-errorlogs --setup=valgrind \ |
| 92 |
--no-suite python-tests |
| 93 |
- name: Upload test logs |
| 94 |
uses: actions/upload-artifact@v4 |
| 95 |
if: failure() |
| 96 |
with: |
| 97 |
name: test logs |
| 98 |
path: | |
| 99 |
build/meson-logs/ |
| 100 |
- name: Ensure doxygen version is correct |
| 101 |
run: | |
| 102 |
doxygen --version > version.txt |
| 103 |
echo "1.9.6" >> version.txt |
| 104 |
if [ $(sort -V version.txt | tail -n1) != "1.9.6" ]; then |
| 105 |
echo "Doxygen version 1.9.6 or earlier expected, see #347" |
| 106 |
exit 1 |
| 107 |
fi |
| 108 |
- name: Store doxygen docs for use by the pages workflow |
| 109 |
uses: actions/upload-artifact@v4 |
| 110 |
if: success() && matrix.compiler == 'gcc' && matrix.sanitizers == 'sanitizers' |
| 111 |
with: |
| 112 |
name: doxygen-docs |
| 113 |
path: | |
| 114 |
build/html/ |
| 115 |
- name: Ruff format |
| 116 |
run: |
| 117 |
ruff format --line-length=88 --check --diff . |