aboutsummaryrefslogtreecommitdiff
blob: e4e58577419dec8defca03eabfdebd21a12efb7d (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
# GitHub actions workflow.
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions

name: Build+Test CI

on: [pull_request, push]

jobs:
  make:
    strategy:
      matrix:
        os: [ubuntu-latest]
        cc: [gcc, clang]
        bb: [meson, muon]
        sanitizer: [none, address, undefined]
      fail-fast: false
    runs-on: ${{ matrix.os }}
    env:
      CC: ${{ matrix.cc }}
      BB: ${{ matrix.bb }}
      SANITIZER: ${{ matrix.sanitizer }}
    steps:
    - name: Install dependencies
      run: |
        sudo apt-get update
        sudo apt-get install -y python3-pyelftools python3-pip \
                                libcap-dev libseccomp-dev ninja-build \
                                pkg-config
        case "$BB" in
          meson)
            sudo pip3 install meson
            ;;
          muon)
            wget https://muon.build/releases/edge/muon-edge-amd64-linux-static -O muon
            chmod +x muon
            sudo install -Dm755 muon /usr/local/bin/muon
            ;;
        esac
    - uses: actions/checkout@v4
    - run: |
        export PKG_CONFIG_PATH="/usr/lib/$(uname -m)-linux-gnu/pkgconfig/"
        case "$BB" in
          muon)
            alias ninja="muon samu"
            ;;
        esac

        "$BB" setup -Duse_libcap=enabled \
                    -Duse_seccomp=true \
                    -Dbuild_manpages=disabled \
                    -Dtests=true \
                    -Duse_fuzzing=true \
                    -Db_sanitize="${SANITIZER}" \
                    build
        ninja -C build
        ( cd build && "$BB" test -v ; )

  build-macos:
    strategy:
      matrix:
        os: [macos-latest]
        cc: [clang]
    runs-on: ${{ matrix.os }}
    env:
      CC: ${{ matrix.cc }}
    steps:
    - name: Install dependencies
      run: brew install meson ninja
    - uses: actions/checkout@v4
    - run: |
        meson -Duse_libcap=disabled \
              -Duse_seccomp=false \
              -Dbuild_manpages=disabled \
              -Dtests=true \
              -Duse_fuzzing=false \
              build
        ninja -C build
        # The unittests generally assume a Linux ELF host, so don't bother making
        # sure they pass on macOS.  Run them out of morbid curiosity I guess.
        ninja -kC build test ||: