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