diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a327845 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,47 @@ +name: Test + +on: + push: + branches: + - master + - main + pull_request: + branches: + - master + - main + +env: + CTEST_OUTPUT_ON_FAILURE: 1 + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] + + steps: + - uses: actions/checkout@v2 + + - uses: actions/cache@v2 + with: + path: "**/cpm_modules" + key: ${{ matrix.os }}-${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} + + - name: configure + run: cmake -Stest -Bbuild -DENABLE_TEST_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug + + - name: build + run: cmake --build build -j4 + + - name: test + run: | + cd build + ctest --build-config Debug + + - name: collect code coverage on ubuntu + if: startsWith(matrix.os,'ubuntu') + run: bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"