Fix issues detected by static analysis tool
[platform/upstream/libxkbcommon.git] / .github / workflows / linux.yml
1 name: linux
2
3 on:
4   push:
5     branches: [ master ]
6   pull_request:
7     branches: [ master ]
8
9 # Set permissions at the job level.
10 permissions: {}
11
12 jobs:
13   linux:
14     runs-on: ubuntu-22.04
15     permissions:
16       contents: read
17     strategy:
18       matrix:
19         compiler: [clang, gcc]
20     steps:
21       - uses: actions/checkout@v3
22         with:
23           persist-credentials: false
24       - uses: actions/setup-python@v4
25         with:
26           python-version: '3.9'
27       - name: Install dependencies
28         run: |
29           python -m pip install --upgrade meson PyYAML
30           sudo apt update
31           sudo apt install -y \
32             doxygen libxcb-xkb-dev valgrind ninja-build \
33             libwayland-dev wayland-protocols bison graphviz
34       - name: Install xkeyboard-config
35         run: |
36           # Install master version of xkeyboard-config, in order to ensure
37           # its latest version works well with xkbcommon.
38           # HACK: We use meson to install, while it would be cleaner
39           #       to create a proper package to install or use some PPA.
40           pushd ~
41           git clone --depth=1 https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config.git
42           cd "xkeyboard-config"
43           BUILDDIR=build
44           meson setup $BUILDDIR -Dprefix=/usr
45           meson install -C $BUILDDIR
46           popd
47       - name: Setup
48         run: |
49           # -gdwarf-4 - see https://github.com/llvm/llvm-project/issues/56550.
50           CFLAGS='-gdwarf-4' meson setup build -Denable-cool-uris=true
51         env:
52           CC: ${{ matrix.compiler }}
53       - name: Build
54         run: |
55           meson compile -C build
56       - name: Test
57         run:
58           meson test -C build --print-errorlogs --no-suite python-tests
59       - name: Test with valgrind
60         run:
61           meson test -C build --print-errorlogs --setup=valgrind --no-suite python-tests
62       - name: Upload test logs
63         uses: actions/upload-artifact@v3
64         if: failure()
65         with:
66           name: test logs
67           path: |
68             build/meson-logs/
69       - name: Ensure doxygen version is correct
70         run: |
71             doxygen --version > version.txt
72             echo "1.9.6" >> version.txt
73             if [ $(sort -V version.txt | tail -n1) != "1.9.6" ]; then
74                 echo "Doxygen version 1.9.6 or earlier expected, see #347"
75                 exit 1
76             fi
77       - name: Store doxygen docs for use by the pages workflow
78         uses: actions/upload-artifact@v3
79         if: success()
80         with:
81           name: doxygen-docs
82           path: |
83             build/html/