diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6f7a6d9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,163 @@ +name: Build + +on: + pull_request: + branches: + - master + +jobs: + build: + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + # GCC/G++ + - os: ubuntu-16.04 + CC: gcc + version: "4.8" + type: Debug + - os: ubuntu-16.04 + CC: gcc + version: "4.8" + type: Release + - os: ubuntu-16.04 + CC: gcc + version: "5" + type: Debug + - os: ubuntu-16.04 + CC: gcc + version: "5" + type: Release + - os: ubuntu-18.04 + CC: gcc + version: "6" + type: Debug + - os: ubuntu-18.04 + CC: gcc + version: "6" + type: Release + - os: ubuntu-18.04 + CC: gcc + version: "7" + type: Debug + - os: ubuntu-18.04 + CC: gcc + version: "7" + type: Release + - os: ubuntu-18.04 + CC: gcc + version: "8" + type: Debug + - os: ubuntu-18.04 + CC: gcc + version: "8" + type: Release + - os: ubuntu-20.04 + CC: gcc + version: "9" + type: Debug + - os: ubuntu-20.04 + CC: gcc + version: "9" + type: Release + - os: ubuntu-20.04 + CC: gcc + version: "10" + type: Debug + - os: ubuntu-20.04 + CC: gcc + version: "10" + type: Release + # Clang + - os: ubuntu-18.04 + CC: clang + version: "6.0" + type: Debug + - os: ubuntu-18.04 + CC: clang + version: "6.0" + type: Release + - os: ubuntu-20.04 + CC: clang + version: "10" + type: Debug + - os: ubuntu-20.04 + CC: clang + version: "10" + type: Release + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Checkout submodules + uses: textbook/git-checkout-submodule-action@master + + - name: Install compiler + run: | + sudo apt-get install -y ${{ matrix.config.CC }}-${{ matrix.config.version }} + if [ ${{ matrix.config.CC }} == "gcc" ] + then + sudo apt-get install -y g++-${{ matrix.config.version }} + fi + + - name: Install build dependencies + run: sudo apt-get install -y libboost-filesystem-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev ccache + + # See https://cristianadam.eu/20200113/speeding-up-c-plus-plus-github-actions-using-ccache/ + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::set-output name=timestamp::${current_date}") + + - name: Configure ccache + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ${{ matrix.config.os }}-${{ matrix.config.CC }}-${{ matrix.config.version }}-${{ matrix.config.type }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + restore-keys: ${{ matrix.config.os }}-${{ matrix.config.CC }}-${{ matrix.config.version }}-${{ matrix.config.type }}-ccache- + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system + shell: bash + working-directory: ${{runner.workspace}}/build + run: | + export CC="ccache ${{ matrix.config.CC }}-${{ matrix.config.version }}" + if [ ${{ matrix.config.CC }} == "gcc" ] + then + export CXX="ccache g++-${{ matrix.config.version }}" + else + export CXX="ccache clang++-${{ matrix.config.version }}" + fi + if [ ${{ matrix.config.version }} == "4.8" ] + then + STRICT=OFF + DBSIM=OFF + else + STRICT=ON + DBSIM=ON + fi + cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.config.type }} \ + -DWSREP_LIB_MAINTAINER_MODE:BOOL=ON \ + -DWSREP_LIB_STRICT_BUILD_FLAGS:BOOL=$STRICT \ + -DWSREP_LIB_WITH_DBSIM:BOOL=$DBSIM \ + -DWSREP_LIB_WITH_ASAN:BOOL=ON . + + - name: Build + working-directory: ${{runner.workspace}}/build + shell: bash + run: | + make -j3 VERBOSE=1 + ccache -s + + - name: Test + working-directory: ${{runner.workspace}}/build + shell: bash + run: ctest -C ${{ matrix.config.type }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2b5c0fa..0000000 --- a/.travis.yml +++ /dev/null @@ -1,386 +0,0 @@ -language: cpp - -matrix: - include: - - os: linux - dist: trusty - name: "GCC 4.4 Debug" - addons: - apt: - packages: - - cmake - - gcc-4.4 - - g++-4.4 - env: MATRIX_EVAL="CC=gcc-4.4 CXX=g++-4.4 TYPE=Debug STRICT=OFF UNIT_TESTS=OFF ASAN=OFF DBSIM=OFF" - - os: linux - dist: trusty - name: "GCC 4.4 RelWithDebInfo" - addons: - apt: - packages: - - cmake - - gcc-4.4 - - g++-4.4 - env: MATRIX_EVAL="CC=gcc-4.4 CXX=g++-4.4 TYPE=RelWithDebInfo STRICT=OFF UNIT_TESTS=OFF ASAN=OFF DBSIM=OFF" - - os: linux - dist: trusty - name: "GCC 4.7 Debug" - addons: - apt: - packages: - - cmake - - libboost-test-dev - - gcc-4.7 - - g++-4.7 - env: MATRIX_EVAL="CC=gcc-4.7 CXX=g++-4.7 TYPE=Debug STRICT=OFF UNIT_TESTS=ON ASAN=OFF DBSIM=OFF" - - os: linux - dist: trusty - name: "GCC 4.7 RelWithDebInfo" - addons: - apt: - packages: - - cmake - - libboost-test-dev - - gcc-4.7 - - g++-4.7 - env: MATRIX_EVAL="CC=gcc-4.7 CXX=g++-4.7 TYPE=RelWithDebInfo STRICT=OFF UNIT_TESTS=ON ASAN=OFF DBSIM=OFF" - - - os: linux - dist: trusty - name: "GCC 4.8 Debug" - addons: - apt: - packages: - - cmake - - libboost-test-dev - env: MATRIX_EVAL="TYPE=Debug STRICT=OFF UNIT_TESTS=ON ASAN=ON DBSIM=OFF" - - os: linux - dist: trusty - name: "GCC 4.8 RelWithDebInfo" - addons: - apt: - packages: - - cmake - - libboost-test-dev - env: MATRIX_EVAL="TYPE=RelWithDebInfo STRICT=OFF UNIT_TESTS=ON ASAN=ON DBSIM=OFF" - - os: linux - dist: xenial - name: "GCC 5 Debug" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-5 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-5 CXX=g++-5 TYPE=Debug STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: xenial - name: "GCC 5 RelWithDebInfo" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-5 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-5 CXX=g++-5 TYPE=RelWithDebInfo STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: xenial - name: "GCC 6 Debug" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-6 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-6 CXX=g++-6 TYPE=Debug STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: xenial - name: "GCC 6 RelWithDebInfo" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-6 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-6 CXX=g++-6 TYPE=RelWithDebInfo STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: bionic - name: "GCC 7 Debug" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-7 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-7 CXX=g++-7 TYPE=Debug STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: bionic - name: "GCC 7 RelWithDebInfo" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-7 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-7 CXX=g++-7 TYPE=RelWithDebInfo STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: bionic - name: "GCC 8 Debug" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-8 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-8 CXX=g++-8 TYPE=Debug STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: bionic - name: "GCC 8 RelWithDebInfo" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-8 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-8 CXX=g++-8 TYPE=RelWithDebInfo STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: bionic - name: "GCC 9 Debug" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-9 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-9 CXX=g++-9 TYPE=Debug STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: bionic - name: "GCC 9 RelWithDebInfo" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-9 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-9 CXX=g++-9 TYPE=RelWithDebInfo STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: bionic - name: "GCC 10 Debug" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-10 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-10 CXX=g++-10 TYPE=Debug STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: bionic - name: "GCC 10 RelWithDebInfo" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-10 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=gcc-10 CXX=g++-10 TYPE=RelWithDebInfo STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: trusty - name: "Clang 3.6 Debug" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.6 - packages: - - clang-3.6 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=clang-3.6 CXX=clang++-3.6 TYPE=Debug STRICT=ON UNIT_TESTS=ON ASAN=ON DBSIM=ON" - - os: linux - dist: trusty - name: "Clang 3.6 RelWithDebInfo" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.6 - packages: - - clang-3.6 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=clang-3.6 CXX=clang++-3.6 TYPE=RelWithDebInfo STRICT=ON UNIT_TESTS=ON ASAN=OFF DBSIM=ON" - - os: linux - name: "Clang 4.0 Debug" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - clang-4.0 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=clang-4.0 CXX=clang++-4.0 TYPE=Debug STRICT=ON UNIT_TESTS=ON ASAN=OFF DBSIM=OFF" - - os: linux - name: "Clang 4.0 RelWithDebInfo" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - clang-4.0 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=clang-4.0 CXX=clang++-4.0 TYPE=RelWithDebInfo STRICT=ON UNIT_TESTS=ON ASAN=OFF DBSIM=OFF" - - os: linux - name: "Clang 5.0 Debug" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - clang-5.0 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=clang-5.0 CXX=clang++-5.0 TYPE=Debug STRICT=ON UNIT_TESTS=ON ASAN=OFF DBSIM=OFF" - - os: linux - name: "Clang 5.0 RelWithDebInfo" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - clang-5.0 - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=clang-5.0 CXX=clang++-5.0 TYPE=RelWithDebInfo STRICT=ON ASAN=OFF DBSIM=OFF" - - os: linux - name: "Clang 7.0 Debug" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-xenial-7.0 - packages: - - clang - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=clang CXX=clang++ TYPE=Debug STRICT=ON UNIT_TESTS=ON ASAN=OFF DBSIM=OFF" - - os: linux - name: "Clang 7.0 RelWithDebInfo" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-xenial-7.0 - packages: - - clang - - cmake - - libboost-test-dev - - libboost-program-options-dev - - libboost-filesystem-dev - - libboost-thread-dev - env: MATRIX_EVAL="CC=clang CXX=clang++ TYPE=RelWithDebInfo STRICT=ON UNIT_TESTS=ON ASAN=OFF DBSIM=OFF" - - os: osx - osx_image: xcode10.1 - name: "Xcode 10.1 Debug" - env: MATRIX_EVAL="CC=clang CXX=clang++ TYPE=Debug STRICT=ON UNIT_TESTS=ON ASAN=OFF DBSIM=OFF" - - os: osx - osx_image: xcode10.1 - name: "Xcode 10.1 RelWithDebInfo" - env: MATRIX_EVAL="CC=clang CXX=clang++ TYPE=RelWithDebInfo STRICT=ON UNIT_TESTS=ON ASAN=OFF DBSIM=OFF" - -before_install: - - eval ${MATRIX_EVAL} - -script: - - echo CC=${CC} CXX=${CXX} TYPE=${TYPE} STRICT=${STRICT} ${UNIT_TESTS} ASAN=${ASAN} DBSIM=${DBSIM} - - cmake . -DCMAKE_BUILD_TYPE=${TYPE} - -DWSREP_LIB_MAINTAINER_MODE:BOOL=ON - -DWSREP_LIB_STRICT_BUILD_FLAGS:BOOL=${STRICT} - -DWSREP_LIB_WITH_UNIT_TESTS:BOOL=${UNIT_TESTS} - -DWSREP_LIB_WITH_DBSIM:BOOL=${DBSIM} - -DWSREP_LIB_WITH_ASAN:BOOL=${ASAN} - - make VERBOSE=1 -j 4 - - make test ARGS=--verbose -