-
-
Notifications
You must be signed in to change notification settings - Fork 194
137 lines (120 loc) · 4.16 KB
/
check.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
name: Portal CI
on: [push, pull_request]
env:
DEBIAN_FRONTEND: noninteractive
TESTS_TIMEOUT: 10 # in minutes
jobs:
check:
name: Ubuntu 22.04 build
runs-on: ubuntu-22.04
strategy:
matrix:
compiler: ['gcc', 'clang']
sanitizer: ['address']
env:
UBUNTU_VERSION: '22.04'
CC: ${{ matrix.compiler }}
BASE_CFLAGS: -Wp,-D_FORTIFY_SOURCE=2
BUILD_CONTAINER: ${{ matrix.compiler }}-build-container
RUN_CMD: docker exec -t -w /src -e TEST_IN_CI -e ASAN_OPTIONS -e G_MESSAGES_DEBUG -e XDG_DATA_DIRS ${{ matrix.compiler }}-build-container
AS_USER: runuser -u tester --
BUILDDIR: builddir
steps:
- name: Prepare environment
id: env-setup
run: |
echo "cflags=$BASE_CFLAGS" >> $GITHUB_OUTPUT;
- name: Prepare container
run: |
docker run --name $BUILD_CONTAINER \
--tty --device /dev/fuse --cap-add SYS_ADMIN \
--security-opt apparmor:unconfined \
-v $(pwd):/src \
-e DEBIAN_FRONTEND \
-e DEBCONF_NONINTERACTIVE_SEEN=true \
-e TERM=dumb \
-e MAKEFLAGS="-j $(getconf _NPROCESSORS_ONLN)" \
-e CC -e CFLAGS="${{ steps.env-setup.outputs.cflags }}" \
-d ubuntu:$UBUNTU_VERSION sleep infinity
- name: Install dependencies
run: |
$RUN_CMD apt-get update --quiet
$RUN_CMD apt-get upgrade --quiet -y
$RUN_CMD apt-get install --quiet -y --no-install-recommends \
${{ matrix.compiler }} \
desktop-file-utils \
fuse3 \
gettext \
git \
gnome-desktop-testing \
gtk-doc-tools \
libcap2-bin \
libflatpak-dev \
libfontconfig1-dev \
libfuse3-dev \
libgdk-pixbuf-2.0-dev \
libgeoclue-2-dev \
libglib2.0-dev \
libjson-glib-dev \
libpipewire-0.3-dev \
libportal-dev \
libsystemd-dev \
libtool \
llvm \
python3-gi \
shared-mime-info
- name: Install dependencies for meson
run: |
$RUN_CMD apt-get install --quiet -y --no-install-recommends \
meson
- name: Install dependencies for the pytest test suite
run: |
$RUN_CMD apt-get install --quiet -y --no-install-recommends \
python3-pytest python3-pytest-xdist python3-dbusmock python3-dbus
- name: Check out xdg-desktop-portal
uses: actions/checkout@v3
- name: Setup test user
run: |
$RUN_CMD adduser --disabled-password --gecos "" tester
$RUN_CMD chown tester:tester . -R
- name: Build xdg-desktop-portal
run: |
$RUN_CMD $AS_USER meson setup ${BUILDDIR} $MESON_OPTIONS
$RUN_CMD $AS_USER meson compile -C ${BUILDDIR}
env:
MESON_OPTIONS: -Dinstalled-tests=true -Dpytest=enabled -Db_sanitize=${{ matrix.sanitizer }}
- name: Run xdg-desktop-portal tests
run: $RUN_CMD $AS_USER timeout --signal=KILL -v ${TESTS_TIMEOUT}m meson test -C ${BUILDDIR}
env:
TEST_IN_CI: 1
G_MESSAGES_DEBUG: all
- name: Install xdg-desktop-portal
run: $RUN_CMD meson install -C ${BUILDDIR}
- name: Run xdg-desktop-portal installed-tests
run: |
test -n "$($RUN_CMD $AS_USER gnome-desktop-testing-runner -l xdg-desktop-portal)"
$RUN_CMD $AS_USER \
env TEST_INSTALLED_IN_CI=1 XDG_DATA_DIRS=/src/tests/share/:$XDG_DATA_DIRS \
gnome-desktop-testing-runner --report-directory installed-test-logs/ \
-t $((TESTS_TIMEOUT * 60)) xdg-desktop-portal
env:
G_MESSAGES_DEBUG: all
TEST_IN_CI: 1
XDG_DATA_DIRS: /usr/local/share:/usr/share
- name: Create dist tarball
run: |
$RUN_CMD $AS_USER ls -la
$RUN_CMD $AS_USER timeout --signal=KILL -v ${TESTS_TIMEOUT}m meson dist -C ${BUILDDIR}
env:
TEST_IN_CI: 1
G_MESSAGES_DEBUG: all
- name: Upload test logs
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: test logs
path: |
tests/*.log
test-*.log
installed-test-logs/
builddir/meson-logs/testlog.txt