Extended CI workflow to support MacOS and Windows
This commit is contained in:
parent
82ac083886
commit
ddd5cefb8b
64
.github/workflows/cmake.yml
vendored
64
.github/workflows/cmake.yml
vendored
@ -2,9 +2,9 @@ name: CMake
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches: [ master, main ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
branches: [ master, main ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
@ -12,33 +12,47 @@ env:
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
# cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
build-ubuntu:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-18.04]
|
||||
compiler: [g++-7, g++-9, g++-10, clang++]
|
||||
|
||||
os: [ ubuntu-18.04, ubuntu-20.04, ubuntu-22.04 ]
|
||||
compiler: [ g++-7, g++-9, g++-10, clang++ ]
|
||||
name: Build and Test on Ubuntu
|
||||
runs-on: ${{matrix.os}}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure CMake
|
||||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_COMPILER=${{matrix.compiler}}
|
||||
|
||||
run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=${{matrix.compiler}}
|
||||
- name: Build
|
||||
# Build your program with the given configuration
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
|
||||
run: cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ctest -C ${{env.BUILD_TYPE}}
|
||||
working-directory: ${{github.workspace}}/build/test
|
||||
run: ctest -C $BUILD_TYPE --output-on-failure
|
||||
|
||||
build-macos:
|
||||
name: Build and Test on MacOS
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure CMake
|
||||
run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
- name: Build
|
||||
run: cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build/test
|
||||
shell: bash
|
||||
run: ctest -C $BUILD_TYPE --output-on-failure
|
||||
|
||||
build-windows:
|
||||
name: Build and Test on Windows
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Configure CMake
|
||||
run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -T "ClangCl"
|
||||
- name: Build
|
||||
run: cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build/test
|
||||
run: cd $BUILD_TYPE && ./link_test && ./options_test
|
||||
|
||||
Loading…
Reference in New Issue
Block a user