diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..bd4daf3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,66 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events + push: + pull_request: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + strategy: + matrix: + compiler: [ clang++, g++ ] + cxx: [ 98, 11, 14, 17 ] + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Dependencies + - name: Install build tools + run: | + sudo apt update + sudo apt install -y clang g++ cmake git + - name: Install dependencies + run: | + git clone --depth 1 https://github.com/catchorg/Catch2.git --branch v2.x + cmake \ + -HCatch2 \ + -BCatch2/build \ + -DBUILD_TESTING=OFF \ + -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \ + -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} \ + -DCMAKE_INSTALL_PREFIX:PATH=~/ext + cmake \ + --build Catch2/build/ \ + --target install + - name: Create build files + run: | + cmake \ + -H. \ + -Bbuild \ + -DBUILD_TESTING:BOOL=ON \ + -DCMAKE_BUILD_TYPE:STRING=Debug \ + -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \ + -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} \ + -DCMAKE_PREFIX_PATH:PATH=~/ext + - name: Build code + run: | + cmake \ + --build build \ + --config Debug + - name: Run tests + run: | + cd build + ctest -C Debug