From ffccde447fd9d1e63f1b74a5ccdb96eecc3d7817 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 13 Feb 2024 08:34:47 -0500 Subject: Create cmake-multi-platform.yml --- .github/workflows/cmake-multi-platform.yml | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/cmake-multi-platform.yml diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml new file mode 100644 index 0000000..125e068 --- /dev/null +++ b/.github/workflows/cmake-multi-platform.yml @@ -0,0 +1,53 @@ +name: CMake on multiple platforms + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + os: [ubuntu-latest, macos-latest] + build_type: [RelWithDebInfo] + c_compiler: [gcc, clang] + include: + - os: macos-latest + c_compiler: clang + - os: ubuntu-latest + c_compiler: gcc + - os: ubuntu-latest + c_compiler: clang + exclude: + - os: macos-latest + c_compiler: gcc + + steps: + - uses: actions/checkout@v3 + + - name: Set reusable strings + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Configure CMake + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + + # TODO: Write ctests + #- name: Test + # working-directory: ${{ steps.strings.outputs.build-output-dir }} + # run: ctest --build-config ${{ matrix.build_type }} -- cgit