diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b9ced774 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,141 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + # Enable parallel builds + CMAKE_BUILD_PARALLEL_LEVEL: 4 + +jobs: + build-and-test-linux: + runs-on: ubuntu-latest + + strategy: + matrix: + build-type: [Debug, Release] + #enable-coverage: [false, true] + #exclude: + # - build-type: Debug + # enable-coverage: true + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cache/ccache + ~/.local + key: ${{ runner.os }}-deps-${{ hashFiles('**/CMakeLists.txt', '**/package.json', '**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-deps- + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential \ + cmake \ + bison \ + flex \ + libgmp-dev \ + libboost-program-options-dev \ + libboost-iostreams-dev \ + libboost-test-dev \ + libboost-thread-dev \ + libboost-system-dev \ + libreadline-dev \ + default-jre \ + gperf \ + python3-pip \ + ccache + + - name: Setup ccache + run: | + echo "CCACHE_DIR=$HOME/.cache/ccache" >> $GITHUB_ENV + ccache --max-size=1G + + - name: Install SMT solvers + run: | + bash contrib/install_yices2.sh + + #- name: Install coverage tools + # if: matrix.enable-coverage + # run: | + # pip3 install --user cpp-coveralls + + - name: Configure and build + run: | + mkdir -p build + cd build + #cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DENABLE_COVERAGE=${{ matrix.enable-coverage }} .. + cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} .. + make -j${{ env.CMAKE_BUILD_PARALLEL_LEVEL }} + + # - name: Run tests + # run: | + # cd build + # make check + # timeout-minutes: 30 + + #- name: Upload coverage to Coveralls + # if: matrix.enable-coverage + # run: | + # cd build + # coveralls -r .. -b . --gcov-options '\-lp' + # env: + # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + + - name: Show ccache statistics + run: ccache -s + + build-macos: + runs-on: macos-latest + + strategy: + matrix: + build-type: [Debug, Release] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies via Homebrew + run: | + brew update + brew install cmake boost gmp bison flex readline ccache autoconf automake libtool + + - name: Install SMT solvers + run: | + bash contrib/install_yices2.sh + + - name: Install Java + run: | + brew install --cask temurin + + - name: Setup ccache + run: | + echo "CCACHE_DIR=$HOME/.cache/ccache" >> $GITHUB_ENV + ccache --max-size=1G + + - name: Configure and build + run: | + mkdir -p build + cd build + cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_PREFIX_PATH=$BREW_PREFIX .. + make -j$(sysctl -n hw.ncpu) + + - name: Run tests + run: | + cd build + make check + timeout-minutes: 30 + + - name: Show ccache statistics + run: ccache -s diff --git a/CMakeLists.txt b/CMakeLists.txt index df42702d..9191a7b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ enable_testing() cmake_policy(SET CMP0167 NEW) cmake_policy(SET CMP0135 NEW) -set(CMAKE_CXX_STANDARD 23) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall") # If ENABLE_COVERAGE is defined, try to set coverage flags. diff --git a/README.md b/README.md index 3051e946..5a47d53d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/SRI-CSL/sally.svg?branch=master)](https://travis-ci.org/SRI-CSL/sally) +[![CI](https://github.com/SRI-CSL/sally/workflows/CI/badge.svg)](https://github.com/SRI-CSL/sally/actions?query=workflow%3ACI) [![Coverage Status](https://coveralls.io/repos/SRI-CSL/sally/badge.svg?branch=master)](https://coveralls.io/r/SRI-CSL/sally?branch=master) [![Coverity Scan Build Status](https://scan.coverity.com/projects/5578/badge.svg)](https://scan.coverity.com/projects/5578) diff --git a/contrib/install_yices2.sh b/contrib/install_yices2.sh index ce011727..a5f0fc16 100755 --- a/contrib/install_yices2.sh +++ b/contrib/install_yices2.sh @@ -1,6 +1,24 @@ #!/bin/bash set -e +# Find Homebrew prefix for macOS and set build flags for dependencies +if [[ "$(uname)" == "Darwin" ]]; then + if [ -d /opt/homebrew ]; then + BREW_PREFIX=/opt/homebrew + else + BREW_PREFIX=/usr/local + fi + export CPPFLAGS="-I$BREW_PREFIX/include" + export LDFLAGS="-L$BREW_PREFIX/lib" + export PKG_CONFIG_PATH="$BREW_PREFIX/lib/pkgconfig" + export LD_LIBRARY_PATH="$BREW_PREFIX/lib:$LD_LIBRARY_PATH" + echo "[INFO] macOS build flags set:" + echo "CPPFLAGS=$CPPFLAGS" + echo "LDFLAGS=$LDFLAGS" + echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" +fi + # libpoly pushd . git clone https://github.com/SRI-CSL/libpoly.git @@ -27,6 +45,7 @@ popd pushd . git clone https://github.com/SRI-CSL/yices2.git cd yices2 +export LD_LIBRARY_PATH=/usr/local/lib/:${LD_LIBRARY_PATH} autoconf ./configure --enable-mcsat make