summaryrefslogtreecommitdiff
path: root/.github/workflows/main.yml
blob: b33b292bee7ef24b75f1c0b29cfaf134da084a27 (plain)
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
on: [ push, pull_request ]

env:
  CFLAGS: "-Werror -Wall -Wextra -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers"
  UBUNTU_PACKAGES: libgudev-1.0-dev libxml++2.6-dev valgrind tree python3-pip python3-setuptools libevdev2

jobs:
  ###
  #
  # autotools build job
  #
  autotools:
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        compiler:
          - gcc
          - clang
        make_args:
          - distcheck
    steps:
      - uses: actions/checkout@v2
      - name: Install libwacom dependencies
        run: sudo apt update && sudo apt install -yq --no-install-suggests --no-install-recommends $UBUNTU_PACKAGES
      - name: autotools make ${{matrix.make_args}}
        run: |
          mkdir _build && pushd _build > /dev/null
          ../autogen.sh --disable-silent-rules
          make
          make ${{matrix.make_args}}
          popd > /dev/null
        env:
          CC: ${{matrix.compiler}}
      - name: capture build logs
        uses: actions/upload-artifact@v2
        if: ${{ always() }}  # even if we fail
        with:
          name: autotools test logs
          path: |
            _build/config.log
            _build/test-suite.log
      # And for the distcheck job, let's save the tarball for later use
      - name: move tarballs to top level
        if: matrix.make_args == 'distcheck'
        run: mv _build/libwacom-*tar.* .
      - name: capture tarball from distcheck
        uses: actions/upload-artifact@v2
        if: matrix.make_args == 'distcheck'
        with:
          name: tarball
          path: libwacom-*.tar.bz2

  ###
  #
  # meson build job
  #
  meson:
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        compiler:
          - gcc
          - clang
        meson_options:
          - ''
          # clang requires b_lundef=false for b_santize, see
          # https://github.com/mesonbuild/meson/issues/764
          - '-Db_sanitize=address,undefined -Db_lundef=false'
          - 'valgrind'  # special handling
    steps:
      - uses: actions/checkout@v2
      # install python so we get pip for meson
      - uses: actions/setup-python@v1
        with:
          python-version: '3.8'
      - name: install meson
        run: python -m pip install --upgrade pip meson ninja
      - name: Install libwacom dependencies
        run: sudo apt update && sudo apt install -yq --no-install-suggests --no-install-recommends $UBUNTU_PACKAGES
      - name: install pip dependencies
        run: python -m pip install --upgrade libevdev pyudev pytest
      # for the non-valgrind case, we pass the meson options through and run
      # meson test
      - name: meson test ${{matrix.meson_options}}
        if: ${{matrix.meson_options != 'valgrind'}}
        run: |
          meson setup builddir ${{matrix.meson_options}}
          meson test -C builddir --print-errorlogs
        env:
          CC: ${{matrix.compiler}}
      # for the valgrind case, we need custom setup, the matrix isn't
      # flexible enough for this
      - name: valgrind - meson test ${{matrix.meson_options}}
        if: ${{matrix.meson_options == 'valgrind'}}
        run: |
          meson setup builddir
          meson test -C builddir --print-errorlogs --setup=valgrind --suite=valgrind
        env:
          CC: ${{matrix.compiler}}
      # Capture all the meson logs, even if we failed
      - uses: actions/upload-artifact@v2
        if: ${{ always() }}  # even if we fail
        with:
          name: meson test logs
          path: |
            builddir/meson-logs/testlog*.txt
            builddir/meson-logs/meson-log.txt

  ####
  # /etc/ loading check
  etcdir:
    needs: meson
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        command:
          # A variety of ways to split the database across the two locations
          # we load from.
          - sudo mv /usr/share/libwacom/intuos*.tablet /etc/libwacom
          - sudo mv /usr/share/libwacom/*.tablet /etc/libwacom
          - sudo mv /usr/share/libwacom/*.stylus /etc/libwacom
          # split the libwacom.stylus file into to two files to check for
          # accumlated loading
          - sudo csplit data/libwacom.stylus '/^\[0x822\]/' && sudo mv xx00 /etc/libwacom/first.stylus && sudo mv xx01 /usr/share/libwacom/libwacom.stylus

    steps:
      - uses: actions/checkout@v2
      # install python so we get pip for meson
      - uses: actions/setup-python@v1
        with:
          python-version: '3.8'
      # keep this in sync with the meson job above. We just do it as
      # one step here, it's not supposed to fail if the above succeeded.
      # Exception: everything is run as sudo because we install to /etc
      # and thus need the pip bits available as root
      - name: Prep install
        run: |
          sudo python -m pip install --upgrade pip meson ninja
          sudo apt update && sudo apt install -yq --no-install-suggests --no-install-recommends $UBUNTU_PACKAGES
          sudo python -m pip install --upgrade libevdev pyudev pytest
      - run: meson builddir --prefix=/usr && sudo ninja -C builddir install
      - name: list devices with database in /usr
        run: ./builddir/list-devices > devicelist.default.txt
      - run: sudo mkdir /etc/libwacom
      - name: split the databases between /usr/share and /etc
        run: ${{matrix.command}}
      - name: list devices with database in /etc and /usr
        run: ./builddir/list-devices > devicelist.modified.txt
      - name: compare device database
        run: diff -u8 devicelist.default.txt devicelist.modified.txt

  ###
  #
  # tarball verification
  #
  build-from-tarball:
    needs: autotools
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        buildtool:
          - meson
          - autogen
    env:
      TARBALLDIR: '_tarball_dir'
      INSTALLDIR: '/tmp/libwacom/_inst'
    steps:
      # libwacom dependencies
      - name: Install dependencies
        run: sudo apt update && sudo apt install -yq --no-install-suggests --no-install-recommends $UBUNTU_PACKAGES
      - name: install python
        uses: actions/setup-python@v1
        with:
          python-version: '3.8'
      - name: install pip dependencies
        run: python -m pip install --upgrade libevdev pyudev pytest
      - name: install meson from pip (if needed)
        run: python -m pip install --upgrade pip meson ninja
        if: matrix.buildtool == 'meson'
      - name: fetch tarball from previous job(s)
        uses: actions/download-artifact@v2
        with:
          name: tarball
      - name: extract tarball
        run: |
          mkdir -p "$TARBALLDIR"
          tar xf libwacom-*.tar.bz2 -C "$TARBALLDIR"
      - run: mkdir -p "$INSTALLDIR"
      # The next three jobs are conditional on the buildtool,
      # it's the easiest way to save on duplication
      - name: build from tarball with meson
        if: matrix.buildtool == 'meson'
        run: |
          pushd "$TARBALLDIR"/libwacom-*/
          meson setup builddir --prefix="$INSTALLDIR"
          ninja -C builddir test && ninja -C builddir install
      - name: build from tarball with autogen
        if: matrix.buildtool == 'autogen'
        run: |
          pushd "$TARBALLDIR"/libwacom-*/
          ./autogen.sh --disable-silent-rules --prefix="$INSTALLDIR"
          make && make install