summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 5e682993ca97affa58e14621416e303ccb3fce14 (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
on: [push, pull_request]
name: CI

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
        name: [
          production,
          production-clang,
          production-dbg,
          production-dbg-clang
        ]

        exclude:
          - name: production-clang
            os: macos-latest
          - name: production-dbg
            os: macos-latest
          - name: production-dbg-clang
            os: macos-latest

        include:
          - name: production
            config: production --all-bindings --editline --poly --symfpu
            cache-key: production
            python-bindings: true
            check-examples: true
            exclude_regress: 3-4
            run_regression_args: --no-check-unsat-cores --no-check-proofs

          - name: production-clang
            config: production
            cache-key: productionclang
            check-examples: true
            env: CC=clang CXX=clang++
            os: ubuntu-latest
            exclude_regress: 3-4
            run_regression_args: --no-check-unsat-cores --no-check-proofs

          - name: production-dbg
            config: production --assertions --tracing --unit-testing --symfpu --editline
            cache-key: dbg
            os: ubuntu-latest
            exclude_regress: 3-4
            run_regression_args: --no-check-unsat-cores

          - name: production-dbg-clang
            config: production --assertions --tracing --unit-testing --symfpu --cln --gpl --poly
            cache-key: dbgclang
            env: CC=clang CXX=clang++
            os: ubuntu-latest
            exclude_regress: 3-4
            run_regression_args: --no-check-proofs

    name: ${{ matrix.os }}:${{ matrix.name }}
    runs-on: ${{ matrix.os }}

    steps:

    - uses: actions/checkout@v2

    - name: Install Packages
      if: runner.os == 'Linux'
      run: |
        sudo apt-get update
        sudo apt-get install -y \
          build-essential \
          ccache \
          libcln-dev \
          libgmp-dev \
          libgtest-dev \
          libedit-dev \
          flex \
          libfl-dev \
          flexc++
        python3 -m pip install toml
        python3 -m pip install setuptools
        python3 -m pip install pexpect
        cd /usr/src/googletest
        sudo cmake .
        sudo cmake --build . --target install
        cd -
        echo "/usr/lib/ccache" >> $GITHUB_PATH

    # Note: macOS comes with a libedit; it does not need to brew-installed
    - name: Install Packages (macOS)
      if: runner.os == 'macOS'
      run: |
        brew install \
          ccache \
          cln \
          gmp \
          pkgconfig \
          flex
        python3 -m pip install toml
        python3 -m pip install setuptools
        python3 -m pip install pexpect
        echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH

    - name: Install Python Dependencies
      if: matrix.python-bindings
      run: |
        python3 -m pip install pytest
        python3 -m pytest --version
        python3 -m pip install \
          Cython==0.29.* --install-option="--no-cython-compile"
        echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH

    - name: Restore Dependencies
      id: restore-deps
      uses: actions/cache@v1
      with:
        path: deps/install
        key: ${{ runner.os }}-deps-${{ hashFiles('contrib/get-**') }}-${{ hashFiles('.github/workflows/ci.yml') }}

    - name: Setup Dependencies
      if: steps.restore-deps.outputs.cache-hit != 'true'
      run: |
        ./contrib/get-lfsc-checker

    # GitHub actions currently does not support modifying an already existing
    # cache. Hence, we create a new cache for each commit with key
    # cache-${{ runner.os }}-${{ matrix.cache-key }}-${{ github.sha }}. This
    # will result in an initial cache miss. However, restore-keys will search
    # for the most recent cache with prefix
    # cache-${{ runner.os }}-${{ matrix.cache-key }}-, and if found uses it as
    # a base for the new cache.
    - name: Restore ccache
      id: cache
      uses: actions/cache@v1
      with:
        path: ccache-dir
        key: cache-${{ runner.os }}-${{ matrix.cache-key }}-${{ github.sha }}
        restore-keys: cache-${{ runner.os }}-${{ matrix.cache-key }}-

    - name: Configure ccache
      run: |
        ccache --set-config=cache_dir=${{ github.workspace }}/ccache-dir
        ccache --set-config=compression=true
        ccache --set-config=compression_level=6
        ccache -M 500M
        ccache -z

    - name: Configure
      run: |
        ${{ matrix.env }} ./configure.sh ${{ matrix.config }} \
          --prefix=$(pwd)/build/install \
          --unit-testing \
          --werror

    - name: Build
      run: make -j2
      working-directory: build

    - name: ccache Statistics
      run: ccache -s

    - name: Run CTest
      run: make -j2 check
      env:
        ARGS: --output-on-failure -LE regress[${{ matrix.exclude_regress }}]
        CVC4_REGRESSION_ARGS: --no-early-exit
        RUN_REGRESSION_ARGS: ${{ matrix.run_regression_args }}
      working-directory: build

    - name: Install Check
      run: |
        make -j2 install
        echo -e "#include <cvc4/api/cvc4cpp.h>\nint main() { cvc5::api::Solver s; return 0; }" > /tmp/test.cpp
        g++ -std=c++11 /tmp/test.cpp -I install/include -L install/lib -lcvc4
      working-directory: build

    - name: Python Install Check
      if: matrix.python-bindings
      run: |
       export PYTHONPATH="$PYTHONPATH:$(dirname $(find build/install/ -name "pycvc4" -type d))"
       python3 -c "import pycvc4"

      # Examples are built for non-symfpu builds
    - name: Check Examples
      if: matrix.check-examples && runner.os == 'Linux'
      run: |
        mkdir build
        cd build
        cmake .. -DCMAKE_PREFIX_PATH=$(pwd)/../../build/install/lib/cmake
        make -j2
        ctest -j2 --output-on-failure
      working-directory: examples
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback