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

env:
  CFLAGS: -Werror -Wall -Wextra -Wno-error=sign-compare -Wno-error=unused-parameter

jobs:
  compile:
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        compiler: [ gcc, clang ]
    steps:
      - name: Checkout the repo
        uses: actions/checkout@v2

      - name: Set up build environment / dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y --no-install-recommends \
            xutils-dev xserver-xorg-dev libx11-dev libxi-dev \
            libxrandr-dev libxinerama-dev libudev-dev \
            ${{ matrix.compiler }}
          mkdir _build

      - name: Build the driver
        run: |
          pushd _build > /dev/null
          # We don't want our CFLAGS (especially -Werror) to apply at `configure`
          # time so short-circuit our environment at that moment and provide the
          # flags to `make` instead. Not doing so results in an incorrect config:
          # 'checking for rint in -lm... no' because of a builtin-declaration-mismatch
          # warning (error) in the auto-generated feature test.
          CFLAGS="" CC="${{ matrix.compiler }}" ../autogen.sh --disable-silent-rules
          make CFLAGS="$CFLAGS"
          popd > /dev/null

      - name: Run unit tests
        run: |
          pushd _build > /dev/null
          make check || (cat **/test-suite.log && false)
          popd > /dev/null

      - name: Run distcheck
        run: |
          pushd _build > /dev/null
          make distcheck
          popd > /dev/null