| 1 |
name: "Build and test" |
| 2 |
|
| 3 |
on: [ push, pull_request ] |
| 4 |
|
| 5 |
permissions: |
| 6 |
contents: read |
| 7 |
|
| 8 |
env: |
| 9 |
CFLAGS: "-Werror -Wno-error=missing-field-initializers" |
| 10 |
UBUNTU_PACKAGES: libgudev-1.0-dev libxml++2.6-dev valgrind tree python3-pip python3-setuptools libevdev-dev udev |
| 11 |
PIP_PACKAGES: meson ninja libevdev pyudev pytest yq |
| 12 |
|
| 13 |
jobs: |
| 14 |
build-and-dist: |
| 15 |
runs-on: ubuntu-24.04 |
| 16 |
strategy: |
| 17 |
matrix: |
| 18 |
compiler: |
| 19 |
- gcc |
| 20 |
- clang |
| 21 |
steps: |
| 22 |
- uses: actions/checkout@v4 |
| 23 |
|
| 24 |
- uses: actions/setup-python@v5 |
| 25 |
with: |
| 26 |
python-version: '3.12' |
| 27 |
- uses: ./.github/actions/pkginstall |
| 28 |
with: |
| 29 |
apt: $UBUNTU_PACKAGES |
| 30 |
pip: $PIP_PACKAGES |
| 31 |
- name: make /etc/udev/hwdb.d writable |
| 32 |
run: | |
| 33 |
sudo mkdir -p /etc/udev/hwdb.d |
| 34 |
sudo chmod o+rwx /etc/udev/hwdb.d |
| 35 |
- name: make systemd-hwdb sticky |
| 36 |
run: sudo chmod +s /usr/bin/systemd-hwdb |
| 37 |
- name: meson test ${{matrix.meson_options}} |
| 38 |
uses: ./.github/actions/meson |
| 39 |
env: |
| 40 |
CC: ${{matrix.compiler}} |
| 41 |
|
| 42 |
- name: meson dist |
| 43 |
uses: ./.github/actions/meson |
| 44 |
with: |
| 45 |
ninja_args: dist |
| 46 |
|
| 47 |
- uses: actions/upload-artifact@v4 |
| 48 |
if: ${{ always() }} |
| 49 |
with: |
| 50 |
name: meson test logs-${{matrix.compiler}} ${{matrix.meson_options}} |
| 51 |
path: | |
| 52 |
builddir/meson-logs/* |
| 53 |
|
| 54 |
- name: move tarballs to top level |
| 55 |
run: mv builddir/meson-dist/libwacom-*tar.xz . |
| 56 |
|
| 57 |
- uses: actions/upload-artifact@v4 |
| 58 |
if: ${{ matrix.compiler == 'gcc' && matrix.meson_options == '' }} |
| 59 |
with: |
| 60 |
name: tarball |
| 61 |
path: libwacom-*tar.xz |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
clang-tidy: |
| 68 |
runs-on: ubuntu-24.04 |
| 69 |
steps: |
| 70 |
- uses: actions/checkout@v4 |
| 71 |
|
| 72 |
- uses: actions/setup-python@v5 |
| 73 |
with: |
| 74 |
python-version: '3.12' |
| 75 |
- uses: ./.github/actions/pkginstall |
| 76 |
with: |
| 77 |
apt: $UBUNTU_PACKAGES |
| 78 |
pip: $PIP_PACKAGES |
| 79 |
- name: clang-tidy |
| 80 |
uses: ./.github/actions/meson |
| 81 |
with: |
| 82 |
meson_skip_test: 1 |
| 83 |
ninja_args: clang-tidy |
| 84 |
env: |
| 85 |
CC: clang |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
valgrind: |
| 92 |
runs-on: ubuntu-24.04 |
| 93 |
steps: |
| 94 |
- uses: actions/checkout@v4 |
| 95 |
|
| 96 |
- uses: actions/setup-python@v5 |
| 97 |
with: |
| 98 |
python-version: '3.12' |
| 99 |
- uses: ./.github/actions/pkginstall |
| 100 |
with: |
| 101 |
apt: $UBUNTU_PACKAGES |
| 102 |
pip: $PIP_PACKAGES |
| 103 |
- name: make /etc/udev/hwdb.d writable |
| 104 |
run: | |
| 105 |
sudo mkdir -p /etc/udev/hwdb.d |
| 106 |
sudo chmod o+rwx /etc/udev/hwdb.d |
| 107 |
|
| 108 |
|
| 109 |
- name: valgrind - meson test |
| 110 |
uses: ./.github/actions/meson |
| 111 |
with: |
| 112 |
meson_test_args: --setup=valgrind |
| 113 |
env: |
| 114 |
CC: ${{matrix.compiler}} |
| 115 |
|
| 116 |
- uses: actions/upload-artifact@v4 |
| 117 |
if: ${{ always() }} |
| 118 |
with: |
| 119 |
name: meson test logs-valgrind |
| 120 |
path: | |
| 121 |
builddir/meson-logs/testlog*.txt |
| 122 |
builddir/meson-logs/meson-log.txt |
| 123 |
|
| 124 |
|
| 125 |
etcdir: |
| 126 |
needs: build-and-dist |
| 127 |
runs-on: ubuntu-24.04 |
| 128 |
strategy: |
| 129 |
matrix: |
| 130 |
command: |
| 131 |
|
| 132 |
|
| 133 |
- sudo mv /usr/share/libwacom/wacom-intuos*.tablet /etc/libwacom |
| 134 |
- sudo mv /usr/share/libwacom/*.tablet /etc/libwacom |
| 135 |
- sudo mv /usr/share/libwacom/*.stylus /etc/libwacom |
| 136 |
- sudo mv /usr/share/libwacom/*.tablet $HOME/.config/libwacom |
| 137 |
- sudo mv /usr/share/libwacom/*.stylus $HOME/.config/libwacom |
| 138 |
- sudo mv /usr/share/libwacom/wacom-*.tablet $HOME/.config/libwacom && sudo mv /usr/share/libwacom/huion-*.tablet /etc/libwacom |
| 139 |
|
| 140 |
|
| 141 |
- sudo csplit data/wacom.stylus '/^\[0x56a:0x822\]/' && sudo mv xx00 /etc/libwacom/first.stylus && sudo mv xx01 /usr/share/libwacom/wacom.stylus |
| 142 |
|
| 143 |
steps: |
| 144 |
- uses: actions/checkout@v4 |
| 145 |
|
| 146 |
- uses: actions/setup-python@v5 |
| 147 |
with: |
| 148 |
python-version: '3.12' |
| 149 |
|
| 150 |
|
| 151 |
- uses: ./.github/actions/pkginstall |
| 152 |
with: |
| 153 |
apt: $UBUNTU_PACKAGES |
| 154 |
pip: $PIP_PACKAGES |
| 155 |
pip_precmd: sudo |
| 156 |
- uses: ./.github/actions/meson |
| 157 |
with: |
| 158 |
meson_args: --prefix=/usr |
| 159 |
meson_skip_test: yes |
| 160 |
ninja_args: install |
| 161 |
ninja_precmd: sudo |
| 162 |
- name: list devices with database in /usr |
| 163 |
run: libwacom-list-devices --format=datafile > devicelist.default.txt |
| 164 |
- run: sudo mkdir /etc/libwacom |
| 165 |
- run: sudo mkdir $HOME/.config/libwacom |
| 166 |
- name: split the databases between /usr/share and /etc |
| 167 |
run: ${{matrix.command}} |
| 168 |
- name: list devices with database in /etc and /usr |
| 169 |
run: libwacom-list-devices --format=datafile > devicelist.modified.txt |
| 170 |
- name: compare device database |
| 171 |
run: diff -u8 devicelist.default.txt devicelist.modified.txt |
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
duplicate-devices: |
| 176 |
needs: build-and-dist |
| 177 |
runs-on: ubuntu-24.04 |
| 178 |
steps: |
| 179 |
- uses: actions/checkout@v4 |
| 180 |
|
| 181 |
- uses: actions/setup-python@v5 |
| 182 |
with: |
| 183 |
python-version: '3.12' |
| 184 |
|
| 185 |
|
| 186 |
- uses: ./.github/actions/pkginstall |
| 187 |
with: |
| 188 |
apt: $UBUNTU_PACKAGES |
| 189 |
pip: $PIP_PACKAGES |
| 190 |
pip_precmd: sudo |
| 191 |
- uses: ./.github/actions/meson |
| 192 |
with: |
| 193 |
meson_args: --prefix=/usr |
| 194 |
meson_skip_test: yes |
| 195 |
ninja_args: install |
| 196 |
ninja_precmd: sudo |
| 197 |
- name: list devices with database in /usr |
| 198 |
run: libwacom-list-devices --format=yaml > devicelist.default.txt |
| 199 |
- run: sudo mkdir /etc/libwacom |
| 200 |
|
| 201 |
|
| 202 |
- name: copy and modify tablet files to override another one |
| 203 |
run: | |
| 204 |
sed -e 's/27QHD/27QHD MODIFIED/' data/wacom-cintiq-27hd.tablet | sudo tee /etc/libwacom/wacom-cintiq-27hd.tablet |
| 205 |
sed -e 's/Pro L/Pro L MODIFIED/' -e 's/usb|056a|0358;//' data/wacom-intuos-pro-2-l.tablet | sudo tee /etc/libwacom/wacom-intuos-pro-2-l.tablet |
| 206 |
- name: list all devices for debugging |
| 207 |
run: libwacom-list-devices --format=yaml |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
- name: check for the expected devices to be present (or not present) |
| 213 |
run: | |
| 214 |
test "$(libwacom-list-devices --format=yaml | yq -r '.devices[] | select(.bus == "usb") | select(.vid == "0x056a") | select(.pid == "0x032a") | .name')" == "Wacom Cintiq 27QHD MODIFIED" |
| 215 |
test "$(libwacom-list-devices --format=yaml | yq -r '.devices[] | select(.bus == "bluetooth") | select(.vid == "0x056a") | select(.pid == "0x0361") | .name')" == "Wacom Intuos Pro L MODIFIED" |
| 216 |
test $(libwacom-list-devices --format=yaml | yq -r '.devices[] | select(.bus == "usb") | select(.vid == "0x056a") | select(.pid == "0x0358") | .name' | wc -l) -eq 0 |
| 217 |
test $(libwacom-list-devices --format=yaml | yq -r '.devices[] | select(.bus == "usb") | select(.vid == "0x056a") | select(.pid == "0x032a") | .name' | wc -l) -eq 1 |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
list-local-devices: |
| 222 |
needs: build-and-dist |
| 223 |
runs-on: ubuntu-24.04 |
| 224 |
steps: |
| 225 |
- uses: actions/checkout@v4 |
| 226 |
|
| 227 |
- uses: actions/setup-python@v5 |
| 228 |
with: |
| 229 |
python-version: '3.12' |
| 230 |
|
| 231 |
|
| 232 |
- uses: ./.github/actions/pkginstall |
| 233 |
with: |
| 234 |
apt: $UBUNTU_PACKAGES |
| 235 |
pip: $PIP_PACKAGES |
| 236 |
pip_precmd: sudo |
| 237 |
- uses: ./.github/actions/meson |
| 238 |
with: |
| 239 |
meson_args: --prefix=/usr |
| 240 |
meson_skip_test: yes |
| 241 |
ninja_args: install |
| 242 |
ninja_precmd: sudo |
| 243 |
|
| 244 |
- run: libwacom-list-local-devices |
| 245 |
- run: libwacom-list-local-devices --format=yaml |
| 246 |
- run: libwacom-list-local-devices --format=datafile |
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
clean-svg-check: |
| 251 |
needs: build-and-dist |
| 252 |
runs-on: ubuntu-24.04 |
| 253 |
steps: |
| 254 |
- uses: actions/checkout@v4 |
| 255 |
- uses: actions/setup-python@v5 |
| 256 |
with: |
| 257 |
python-version: '3.12' |
| 258 |
- name: run clean-svg on all .tablet files |
| 259 |
run: | |
| 260 |
for tabletfile in data/*.tablet; do |
| 261 |
echo "Checking $tabletfile" |
| 262 |
./tools/clean_svg.py --ignore-missing "$tabletfile" |
| 263 |
done |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
build-from-tarball: |
| 270 |
needs: build-and-dist |
| 271 |
runs-on: ubuntu-24.04 |
| 272 |
env: |
| 273 |
TARBALLDIR: '_tarball_dir' |
| 274 |
INSTALLDIR: '/tmp/libwacom/_inst' |
| 275 |
steps: |
| 276 |
- uses: actions/checkout@v4 |
| 277 |
- name: install python |
| 278 |
uses: actions/setup-python@v5 |
| 279 |
with: |
| 280 |
python-version: '3.12' |
| 281 |
- uses: ./.github/actions/pkginstall |
| 282 |
with: |
| 283 |
apt: $UBUNTU_PACKAGES |
| 284 |
pip: $PIP_PACKAGES |
| 285 |
- name: fetch tarball from previous job(s) |
| 286 |
uses: actions/download-artifact@v4 |
| 287 |
with: |
| 288 |
name: tarball |
| 289 |
- name: extract tarball |
| 290 |
run: | |
| 291 |
mkdir -p "$TARBALLDIR" |
| 292 |
tar xf libwacom-*.tar.xz -C "$TARBALLDIR" |
| 293 |
- run: mkdir -p "$INSTALLDIR" |
| 294 |
- name: build from tarball with meson |
| 295 |
uses: ./.github/actions/meson |
| 296 |
with: |
| 297 |
srcdir: $TARBALLDIR/libwacom-*/ |
| 298 |
meson_args: --prefix="$INSTALLDIR" |
| 299 |
ninja_args: test install |