From 1708663af915d38508cf2baeb24157c327d278d5 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Thu, 8 Jul 2021 07:10:04 -0700 Subject: github actions: Add a basic CMake build. Run cmake build and test steps on the three supported desktop targets. Default compiler and so on is fine. Although we define an environment variable to hold the path to the cmake build directory, we must use the noisier expression syntax of the github job builder to substitute into each command line for portability across both unix and windows shell syntax. The windows image also requires an explicit build config switch, `-C Debug` or similar, for ctest to execute even though CMakeLists.txt doesn't define alternate build configurations. On linux and macos ctest runs fine without the extra argument. --- .github/workflows/cmake.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/cmake.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 0000000..d9fa86c --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,38 @@ +name: CMake + +on: + push: + pull_request: + schedule: + - cron: '0 0 1 * *' + +jobs: + build: + strategy: + matrix: + os: + [ + ubuntu-latest, + macos-latest, + windows-latest, + ] + + runs-on: ${{ matrix.os }} + + env: + BUILD: _build + + steps: + - uses: actions/checkout@v2 + + - name: Prepare build directory + run: mkdir ${{ env.BUILD }} + + - name: Generate + run: cmake -S . -B ${{ env.BUILD }} + + - name: Build + run: cmake --build ${{ env.BUILD }} + + - name: Test + run: ctest --test-dir ${{ env.BUILD }} -V -C Debug -- cgit v1.2.1