mirror of
https://github.com/microsoft/GSL.git
synced 2025-11-15 14:59:21 +01:00
Update GitHub Actions to use CMake presets for compilers workflow
Co-authored-by: carsonRadtke <10507970+carsonRadtke@users.noreply.github.com>
This commit is contained in:
37
.github/workflows/cmake/action.yml
vendored
37
.github/workflows/cmake/action.yml
vendored
@@ -1,25 +1,29 @@
|
|||||||
name: Composite CMake
|
name: Composite CMake
|
||||||
inputs:
|
inputs:
|
||||||
|
cmake_preset:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
description: 'CMake preset name to use (if provided, other cmake_* inputs are ignored)'
|
||||||
cmake_generator:
|
cmake_generator:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: 'Unix Makefiles'
|
default: 'Unix Makefiles'
|
||||||
cmake_build_type:
|
cmake_build_type:
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: ''
|
default: ''
|
||||||
cmake_cxx_compiler:
|
cmake_cxx_compiler:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
gsl_cxx_standard:
|
gsl_cxx_standard:
|
||||||
required: true
|
required: false
|
||||||
type: number
|
type: number
|
||||||
extra_cmake_args:
|
extra_cmake_args:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: ''
|
default: ''
|
||||||
build_cmd:
|
build_cmd:
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: 'make'
|
default: 'make'
|
||||||
test_cmd:
|
test_cmd:
|
||||||
@@ -35,21 +39,40 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Create build directory
|
- name: Configure CMake (with preset)
|
||||||
|
if: ${{ inputs.cmake_preset != '' }}
|
||||||
|
run: cmake --preset ${{ inputs.cmake_preset }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ inputs.extra_cmake_args }}
|
||||||
|
shell: ${{ inputs.shell }}
|
||||||
|
|
||||||
|
- name: Create build directory (without preset)
|
||||||
|
if: ${{ inputs.cmake_preset == '' }}
|
||||||
run: mkdir build
|
run: mkdir build
|
||||||
shell: ${{ inputs.shell }}
|
shell: ${{ inputs.shell }}
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake (without preset)
|
||||||
|
if: ${{ inputs.cmake_preset == '' }}
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: cmake -G "${{ inputs.cmake_generator }}" -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} -DCMAKE_CXX_COMPILER=${{ inputs.cmake_cxx_compiler }} -DGSL_CXX_STANDARD=${{ inputs.gsl_cxx_standard }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ inputs.extra_cmake_args }} ..
|
run: cmake -G "${{ inputs.cmake_generator }}" -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} -DCMAKE_CXX_COMPILER=${{ inputs.cmake_cxx_compiler }} -DGSL_CXX_STANDARD=${{ inputs.gsl_cxx_standard }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ inputs.extra_cmake_args }} ..
|
||||||
shell: ${{ inputs.shell }}
|
shell: ${{ inputs.shell }}
|
||||||
|
|
||||||
- name: Build
|
- name: Build (with preset)
|
||||||
|
if: ${{ inputs.cmake_preset != '' }}
|
||||||
|
run: cmake --build --preset ${{ inputs.cmake_preset }}
|
||||||
|
shell: ${{ inputs.shell }}
|
||||||
|
|
||||||
|
- name: Build (without preset)
|
||||||
|
if: ${{ inputs.cmake_preset == '' }}
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: ${{ inputs.build_cmd }}
|
run: ${{ inputs.build_cmd }}
|
||||||
shell: ${{ inputs.shell }}
|
shell: ${{ inputs.shell }}
|
||||||
|
|
||||||
- name: Test
|
- name: Test (with preset)
|
||||||
|
if: ${{ inputs.cmake_preset != '' }}
|
||||||
|
run: ctest --preset ${{ inputs.cmake_preset }} --output-on-failure --no-compress-output
|
||||||
|
shell: ${{ inputs.shell }}
|
||||||
|
|
||||||
|
- name: Test (without preset)
|
||||||
|
if: ${{ inputs.cmake_preset == '' }}
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: ${{ inputs.test_cmd }}
|
run: ${{ inputs.test_cmd }}
|
||||||
shell: ${{ inputs.shell }}
|
shell: ${{ inputs.shell }}
|
||||||
|
|||||||
18
.github/workflows/compilers.yml
vendored
18
.github/workflows/compilers.yml
vendored
@@ -35,9 +35,7 @@ jobs:
|
|||||||
- name: Run CMake (configure, build, test)
|
- name: Run CMake (configure, build, test)
|
||||||
uses: ./.github/workflows/cmake
|
uses: ./.github/workflows/cmake
|
||||||
with:
|
with:
|
||||||
cmake_build_type: ${{ matrix.build_type }}
|
cmake_preset: gcc-${{ matrix.cxx_version }}-${{ matrix.build_type == 'Debug' && 'debug' || 'release' }}
|
||||||
cmake_cxx_compiler: g++-${{ matrix.gcc_version }}
|
|
||||||
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
|
||||||
|
|
||||||
clang:
|
clang:
|
||||||
strategy:
|
strategy:
|
||||||
@@ -58,9 +56,7 @@ jobs:
|
|||||||
- name: Run CMake (configure, build, test)
|
- name: Run CMake (configure, build, test)
|
||||||
uses: ./.github/workflows/cmake
|
uses: ./.github/workflows/cmake
|
||||||
with:
|
with:
|
||||||
cmake_build_type: ${{ matrix.build_type }}
|
cmake_preset: clang-${{ matrix.cxx_version }}-${{ matrix.build_type == 'Debug' && 'debug' || 'release' }}
|
||||||
cmake_cxx_compiler: clang++-${{ matrix.clang_version }}
|
|
||||||
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
|
||||||
|
|
||||||
xcode:
|
xcode:
|
||||||
strategy:
|
strategy:
|
||||||
@@ -78,9 +74,7 @@ jobs:
|
|||||||
- name: Run CMake (configure, build, test)
|
- name: Run CMake (configure, build, test)
|
||||||
uses: ./.github/workflows/cmake
|
uses: ./.github/workflows/cmake
|
||||||
with:
|
with:
|
||||||
cmake_build_type: ${{ matrix.build_type }}
|
cmake_preset: clang-${{ matrix.cxx_version }}-${{ matrix.build_type == 'Debug' && 'debug' || 'release' }}
|
||||||
cmake_cxx_compiler: clang++
|
|
||||||
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
|
||||||
extra_cmake_args: '-DCMAKE_CXX_FLAGS="-isysroot \"$(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk\""'
|
extra_cmake_args: '-DCMAKE_CXX_FLAGS="-isysroot \"$(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk\""'
|
||||||
|
|
||||||
VisualStudio:
|
VisualStudio:
|
||||||
@@ -99,11 +93,7 @@ jobs:
|
|||||||
- name: Run CMake (configure, build, test)
|
- name: Run CMake (configure, build, test)
|
||||||
uses: ./.github/workflows/cmake
|
uses: ./.github/workflows/cmake
|
||||||
with:
|
with:
|
||||||
cmake_generator: ${{ matrix.generator }}
|
cmake_preset: msvc-${{ matrix.cxx_version }}-${{ matrix.build_type == 'Debug' && 'debug' || 'release' }}
|
||||||
cmake_build_type: ${{ matrix.build_type }}
|
|
||||||
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
|
||||||
extra_cmake_args: ${{ matrix.extra_args }}
|
extra_cmake_args: ${{ matrix.extra_args }}
|
||||||
build_cmd: msbuild GSL.sln
|
|
||||||
test_cmd: ctest . --output-on-failure --no-compress-output
|
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user