Skip to content

DRAFT 214 - Test initial Github workflow #1

DRAFT 214 - Test initial Github workflow

DRAFT 214 - Test initial Github workflow #1

# This workflow is for a CMake project running on multiple platforms.
name: CMake on multiple platforms
on:
push:
branches: [ "draft-actions" ] ## fix
pull_request:
branches: [ "master" ]
jobs:
build:
name: ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.c_compiler }})
runs-on: ${{ matrix.os }}
strategy:
# Deliver the feedback for all matrix combinations.
fail-fast: false
matrix:
target_arch: [ amd64 ]
os: [ ubuntu-latest, windows-latest ]
build_type: [ Release ]
c_compiler: [ gcc, clang, cl ]
include:
- os: windows-latest
c_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
- os: ubuntu-latest
c_compiler: clang
steps:
- uses: actions/checkout@v3
- name: Set reusable strings
# Turn repeated input strings into step outputs.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
# Configure CMake in a 'build' subdirectory.
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
# Build the code with the given configuration.
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration.
run: ctest --build-config ${{ matrix.build_type }}