-
Notifications
You must be signed in to change notification settings - Fork 21
287 lines (275 loc) · 10.2 KB
/
ci.yaml
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
276
277
278
279
280
281
282
283
284
285
286
287
---
name: CI
on: # yamllint disable-line rule:truthy
- push
- pull_request
env:
DEBIAN_FRONTEND: noninteractive
# Note: ca-certificates and git are needed for actions/checkout to use git
# which is needed for codecov/codecov-action.
jobs:
linter:
runs-on: ubuntu-latest
strategy:
fail-fast: false
container:
image: ubuntu:plucky
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: >
apt-get update
&& apt-get install --no-install-recommends --yes
black gir1.2-gtk-3.0 gir1.2-wnck-3.0 isort mypy pycodestyle
pydocstyle pyflakes3 pylint python3 python3-apt python3-dbus
python3-distutils-extra python3-gi python3-launchpadlib
python3-psutil python3-pyqt5 python3-pytest python3-rpm
python3-typeshed python3-yaml python3-systemd python3-zstandard
- name: Run linter tests
run: tests/run-linters
unit-and-integration:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container:
- debian:bookworm-slim
- debian:testing-slim
- ubuntu:noble
- ubuntu:oracular
- ubuntu:plucky
container:
image: ${{ matrix.container }}
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
steps:
- name: Sanitize container name (for artifact name)
run: |
container=$(echo "${{ matrix.container }}" | sed 's/:/-/')
echo "JOB=${GITHUB_JOB}-${container}" >> "$GITHUB_ENV"
- name: Install dependencies
run: >
apt-get update
&& apt-get install --no-install-recommends --yes
bash binutils ca-certificates default-jdk-headless dpkg-dev gcc gdb
gir1.2-gtk-3.0 gir1.2-wnck-3.0 git kmod libc6-dev libglib2.0-dev
libxml2-utils locales pkg-config polkitd procps python3 python3-apt
python3-distutils-extra python3-gi python3-launchpadlib python3-psutil
python3-pyqt5 python3-pytest python3-pytest-cov python3-setuptools
python3-systemd python3-zstandard valgrind xterm
- uses: actions/checkout@v4
- name: Enable German locale
run: sed -i 's/^# de_DE/de_DE/g' /etc/locale.gen && locale-gen
- name: Build (Java and PolicyKit XML)
run: >
python3 -m coverage run ./setup.py build
&& python3 -m coverage xml -o coverage-setup.xml
- name: Run unit and integration tests
run: >
python3 -m pytest -ra --cov=$(pwd) --cov-branch --cov-report=xml
--durations=0 tests/unit/ tests/integration/
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ env.JOB }}
path: ./coverage*.xml
unit-and-integration-installed:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
steps:
- name: Remove system installed Apport
run: >
sudo apt-get remove --purge --yes
apport python3-apport python3-problem-report
- name: Install dependencies
run: >
sudo apt-get update
&& sudo apt-get install --no-install-recommends --yes
bash binutils ca-certificates default-jdk-headless dpkg-dev gcc gdb
gir1.2-gtk-3.0 gir1.2-wnck-3.0 git kmod libc6-dev libglib2.0-dev
libxml2-utils locales pkg-config polkitd python3 python3-apt
python3-distutils-extra python3-gi python3-launchpadlib python3-psutil
python3-pyqt5 python3-pytest python3-pytest-cov python3-setuptools
python3-systemd python3-zstandard valgrind xterm
- uses: actions/checkout@v4
- name: Enable German locale
run: sudo sed -i 's/^# de_DE/de_DE/g' /etc/locale.gen && sudo locale-gen
- name: Install
run: >
sudo python3 -m coverage run
./setup.py install --install-layout=deb --prefix=/usr --root=/
&& sudo chown "$SUDO_UID:$SUDO_GID" .coverage
&& python3 -m coverage xml -o coverage-setup.xml
- name: Run unit and integration tests
run: >
WORKDIR=$(mktemp -d -t apport.XXXXXXXXXX)
&& cp -r tests "$WORKDIR"
&& cd "$WORKDIR"
&& python3 -m pytest -ra --cov=$(pwd) --cov-branch --cov-report=xml
--durations=0 tests/unit/ tests/integration/
&& cd -
&& cp "$WORKDIR/coverage.xml" .
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ github.job }}
path: ./coverage*.xml
skip:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container:
- ubuntu:noble
- ubuntu:oracular
- ubuntu:plucky
container:
image: ${{ matrix.container }}
steps:
- name: Sanitize container name (for artifact name)
run: |
container=$(echo "${{ matrix.container }}" | sed 's/:/-/')
echo "JOB=${GITHUB_JOB}-${container}" >> "$GITHUB_ENV"
- name: Install dependencies
run: >
apt-get update
&& apt-get install --no-install-recommends --yes
bash ca-certificates git python3 python3-apt python3-psutil
python3-pytest python3-pytest-cov
- uses: actions/checkout@v4
- name: Run all tests (to check if they are skipped or succeed)
run: >
SKIP_ONLINE_TESTS=1 python3 -m pytest -ra --cov=$(pwd) --cov-branch
--cov-report=xml --durations=0 tests/
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ env.JOB }}
path: ./coverage.xml
system:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container:
- ubuntu:noble
- ubuntu:oracular
- ubuntu:plucky
container:
image: ${{ matrix.container }}
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
steps:
- name: Sanitize container name (for artifact name)
run: |
container=$(echo "${{ matrix.container }}" | sed 's/:/-/')
echo "JOB=${GITHUB_JOB}-${container}" >> "$GITHUB_ENV"
- name: Enable 'deb-src' URIs in /etc/apt/sources.list
run: >
sed -i '/^#\sdeb-src /s/^#\s//' /etc/apt/sources.list
&& ! test -e /etc/apt/sources.list.d/ubuntu.sources
|| sed -i 's/^Types:.*/Types: deb deb-src/g'
/etc/apt/sources.list.d/ubuntu.sources
- name: Install dependencies
run: >
apt-get update
&& apt-get install --no-install-recommends --yes
ca-certificates chaos-marmosets dbus dbus-x11 dirmngr dpkg-dev gcc gdb
gir1.2-gtk-3.0 gir1.2-wnck-3.0 git gnome-icon-theme gvfs-daemons
psmisc python3 python3-apt python3-dbus python3-gi
python3-launchpadlib python3-psutil python3-pyqt5 python3-pytest
python3-pytest-cov ubuntu-dbgsym-keyring ubuntu-keyring valgrind
xterm xvfb
- uses: actions/checkout@v4
- name: Start D-Bus daemon
run: mkdir -p /run/dbus && dbus-daemon --system --fork
- name: Run system tests
env:
GDK_BACKEND: x11
run: >
xvfb-run python3 -m pytest -ra --cov=$(pwd) --cov-branch
--cov-report=xml --durations=0 tests/system/
- name: Stop D-Bus daemon
run: kill $(cat /run/dbus/pid)
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ env.JOB }}
path: ./coverage.xml
system-installed:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
steps:
- name: Remove system installed Apport
run: >
sudo apt-get remove --purge --yes
apport python3-apport python3-problem-report
- name: Enable 'deb-src' URIs in /etc/apt/sources.list.d/ubuntu.sources
run: >
sudo sed -i 's/^Types: deb$/Types: deb deb-src/'
/etc/apt/sources.list.d/ubuntu.sources
- name: Install dependencies
run: >
sudo apt-get update
&& sudo apt-get install --no-install-recommends --yes
ca-certificates chaos-marmosets dbus dbus-x11 dirmngr dpkg-dev gcc gdb
gir1.2-gtk-3.0 gir1.2-wnck-3.0 git gnome-icon-theme gvfs-daemons
pkg-config psmisc python3 python3-apt python3-dbus
python3-distutils-extra python3-gi python3-launchpadlib python3-psutil
python3-pyqt5 python3-pytest python3-pytest-cov python3-setuptools
ubuntu-dbgsym-keyring ubuntu-keyring valgrind xvfb
- uses: actions/checkout@v4
- name: Install
run: >
sudo python3 -m coverage run
./setup.py install --install-layout=deb --prefix=/usr --root=/
&& sudo chown "$SUDO_UID:$SUDO_GID" .coverage
&& python3 -m coverage xml -o coverage-setup.xml
- name: Cleanup /var/crash/
run: sudo rm -f /var/crash/*.crash
- name: Enable Apport
run: sudo /usr/share/apport/apport --start
- name: Run system tests
env:
GDK_BACKEND: x11
run: >
WORKDIR=$(mktemp -d -t apport.XXXXXXXXXX)
&& cp -r tests "$WORKDIR"
&& cd "$WORKDIR"
&& sudo xvfb-run python3 -m pytest -ra --cov=$(pwd) --cov-branch
--cov-report=xml --durations=0 tests/system/
&& cd -
&& cp "$WORKDIR/coverage.xml" .
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ github.job }}
path: ./coverage*.xml
woke:
name: woke
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: woke
uses: get-woke/woke-action@v0
with:
# Cause the check to fail on any broke rules
fail-on-error: true
upload-to-codecov:
if: ${{ always() }}
needs:
- unit-and-integration
- unit-and-integration-installed
- skip
- system
- system-installed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true