Debian Codegraph @

.github/workflows/build-and-test.yml

raw
1 env:
2 TESTS_TIMEOUT: 10 # in minutes
3
4 on:
5 workflow_call:
6 inputs:
7 image:
8 required: true
9 type: string
10 image_options:
11 required: true
12 type: string
13
14 jobs:
15 build-and-test:
16 name: Build and Test
17 runs-on: ubuntu-latest
18 strategy:
19 matrix:
20 compiler: ['gcc', 'clang']
21 sanitizer: ['address']
22
23 container:
24 image: ${{ inputs.image }}
25 env:
26 CFLAGS: -Wp,-D_FORTIFY_SOURCE=2
27 CC: ${{ matrix.compiler }}
28 XDP_TEST_IN_CI: 1
29 G_MESSAGES_DEBUG: all
30 options: ${{ inputs.image_options }}
31
32 steps:
33 - name: Configure environment
34 run: |
35 git config --global --add safe.directory $GITHUB_WORKSPACE
36 echo XDG_DATA_DIRS=$GITHUB_WORKSPACE/tests/share:/usr/local/share:/usr/share | tee -a $GITHUB_ENV
37
38 - name: Check out xdg-desktop-portal
39 uses: actions/checkout@v4
40
41 - name: Run pre-commit hooks
42 run: |
43 export PYTHONPATH="/root/.local/lib/python$(python3 -c 'import sys; print("{}.{}".format(*sys.version_info))')/site-packages:$PYTHONPATH"
44 export PATH="/root/.local/bin:$PATH"
45 pre-commit run --show-diff-on-failure --color=always --all-files
46
47 - name: Check POTFILES.in
48 run: .github/workflows/check-potfiles.sh
49
50 - name: Build xdg-desktop-portal
51 run: |
52 meson setup _build \
53 -Dinstalled-tests=true \
54 -Dtests=enabled \
55 -Db_sanitize=${{ matrix.sanitizer }} \
56 -Db_lundef=false
57 meson compile -C _build
58
59 - name: Run xdg-desktop-portal tests
60 run: timeout --signal=KILL -v ${TESTS_TIMEOUT}m meson test -C _build
61
62 - name: Install xdg-desktop-portal
63 run: meson install -C _build
64
65 - name: Run xdg-desktop-portal installed-tests
66 run: |
67 test -n "$(gnome-desktop-testing-runner -l xdg-desktop-portal)"
68 gnome-desktop-testing-runner --report-directory installed-test-logs/ \
69 -t $((TESTS_TIMEOUT * 60)) xdg-desktop-portal
70
71 - name: Check Qt annotations
72 run: find -name "*.xml" | xargs -n1 /usr/lib/qt6/bin/qdbusxml2cpp
73
74 - name: Create dist tarball
75 run: |
76 ls -la
77 timeout --signal=KILL -v ${TESTS_TIMEOUT}m meson dist -C _build --include-subprojects
78
79 - name: Upload test logs
80 uses: actions/upload-artifact@v4
81 if: success() || failure()
82 with:
83 name: test logs (${{ matrix.compiler }}, ${{ matrix.sanitizer }})
84 path: |
85 tests/*.log
86 test-*.log
87 installed-test-logs/
88 _build/meson-logs/testlog.txt