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 goblint:
16 name: Goblint
17 runs-on: ubuntu-latest
18 container:
19 image: ghcr.io/bilelmoussaoui/goblint:main-9c34d77
20 permissions:
21 # Required for uploading SARIF results
22 security-events: write
23
24 steps:
25 - name: Check out xdg-desktop-portal
26 uses: actions/checkout@v6
27
28 - name: Run goblint
29 run: goblint --format sarif > goblint.sarif
30
31 - name: Upload SARIF results
32 uses: github/codeql-action/upload-sarif@v3
33 with:
34 sarif_file: goblint.sarif
35 category: goblint
36
37 checks:
38 name: Checks
39 runs-on: ubuntu-latest
40 container:
41 image: ${{ inputs.image }}
42 options: ${{ inputs.image_options }}
43
44 steps:
45 - name: Configure environment
46 run: |
47 # Mark workspace as safe, to prevent git from failing
48 git config --global --add safe.directory $GITHUB_WORKSPACE
49 # the image uses `pip install --user`, let's make sure we find it
50 echo PYTHONPATH="/root/.local/lib/python$(python3 -c 'import sys; print("{}.{}".format(*sys.version_info))')/site-packages:$PYTHONPATH" | tee -a $GITHUB_ENV
51 echo PATH="/root/.local/bin:$PATH" | tee -a $GITHUB_ENV
52
53 - name: Check out xdg-desktop-portal
54 uses: actions/checkout@v4
55
56 - name: Check POTFILES.in
57 run: .github/workflows/check-potfiles.sh
58 if: always()
59
60 - name: Check Qt annotations
61 run: find -name "*.xml" | xargs -n1 /usr/lib/qt6/bin/qdbusxml2cpp
62 if: always()
63
64 - name: Run pre-commit hooks
65 run: pre-commit run --show-diff-on-failure --color=always --all-files
66 if: always()
67
68 build-and-test:
69 name: Build and Test
70 runs-on: ubuntu-latest
71 strategy:
72 matrix:
73 compiler: ['gcc', 'clang']
74 sanitizer: ['address']
75
76 container:
77 image: ${{ inputs.image }}
78 env:
79 CFLAGS: -Wp,-D_FORTIFY_SOURCE=2
80 CC: ${{ matrix.compiler }}
81 XDP_TEST_IN_CI: 1
82 G_MESSAGES_DEBUG: all
83 options: ${{ inputs.image_options }}
84
85 steps:
86 - name: Configure environment
87 run: |
88 # Mark workspace as safe, to prevent git from failing
89 git config --global --add safe.directory $GITHUB_WORKSPACE
90
91 - name: Check out xdg-desktop-portal
92 uses: actions/checkout@v4
93
94 - name: Build xdg-desktop-portal
95 run: |
96 meson setup _build \
97 -Dinstalled-tests=true \
98 -Dtests=enabled \
99 -Db_sanitize=${{ matrix.sanitizer }} \
100 -Db_lundef=false \
101 -Dwerror=true
102
103 - name: Run xdg-desktop-portal tests
104 run: XDP_TEST_RUN_LONG=1 timeout --signal=KILL -v ${TESTS_TIMEOUT}m meson test -C _build
105
106 - name: Install xdg-desktop-portal
107 run: meson install -C _build
108
109 - name: Run xdg-desktop-portal installed-tests
110 run: |
111 test -n "$(gnome-desktop-testing-runner -l xdg-desktop-portal)"
112 gnome-desktop-testing-runner --report-directory installed-test-logs/ \
113 -t $((TESTS_TIMEOUT * 60)) xdg-desktop-portal
114
115 - name: Create dist tarball
116 run: |
117 ls -la
118 timeout --signal=KILL -v ${TESTS_TIMEOUT}m meson dist -C _build --include-subprojects
119
120 - name: Upload test logs
121 uses: actions/upload-artifact@v4
122 if: success() || failure()
123 with:
124 name: test logs (${{ matrix.compiler }}, ${{ matrix.sanitizer }})
125 path: |
126 tests/*.log
127 test-*.log
128 installed-test-logs/
129 _build/meson-logs/testlog.txt