mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-28 18:41:57 -05:00
refactor cmake behavior to resuable action
This commit is contained in:
parent
e25059a152
commit
84671a6a8a
59
.github/workflows/cmake/action.yml
vendored
Normal file
59
.github/workflows/cmake/action.yml
vendored
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
name: Composite CMake
|
||||||
|
inputs:
|
||||||
|
cmake_generator:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'Unix Makefiles'
|
||||||
|
cmake_build_type:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
cmake_cxx_compiler:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
gsl_cxx_standard:
|
||||||
|
required: true
|
||||||
|
type: number
|
||||||
|
extra_cmake_args:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
cmake_configure_only:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Create build directory
|
||||||
|
run: mkdir build
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
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 }} \
|
||||||
|
..
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
if: "${{ !inputs.cmake_configure_only }}"
|
||||||
|
working-directory: build
|
||||||
|
run: make
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
if: "${{ !inputs.cmake_configure_only }}"
|
||||||
|
working-directory: build
|
||||||
|
run: make test
|
||||||
|
shell: bash
|
||||||
|
|
87
.github/workflows/compilers.yml
vendored
87
.github/workflows/compilers.yml
vendored
@ -10,14 +10,11 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
||||||
|
# TODO (@carsonradtke)
|
||||||
|
# - [ ] flesh out strategy.matrix
|
||||||
|
# - [ ] Update README with latest versions actively tested
|
||||||
|
# - [ ] Do not use '*-latest' for runs-on
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
# TODO (@carsonradtke)
|
|
||||||
# - [ ] Xcode
|
|
||||||
# - [ ] VS_LLVM
|
|
||||||
# - [ ] Update README with latest versions actively tested
|
|
||||||
# - [ ] Do not use '*-latest' for runs-on
|
|
||||||
|
|
||||||
gcc:
|
gcc:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@ -28,21 +25,13 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: create build directory
|
- name: Run CMake (configure, build, test)
|
||||||
run: mkdir build
|
uses: ./.github/workflows/cmake
|
||||||
|
with:
|
||||||
- name: cmake configure
|
cmake_build_type: ${{ matrix.build_type }}
|
||||||
working-directory: build
|
cmake_cxx_compiler: g++-${{ matrix.gcc_version }}
|
||||||
run: cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DGSL_CXX_STANDARD=${{ matrix.cxx_version }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev -DCMAKE_CXX_COMPILER=g++-${{ matrix.gcc_version }} ..
|
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
||||||
|
|
||||||
- name: build
|
|
||||||
working-directory: build
|
|
||||||
run: make
|
|
||||||
|
|
||||||
- name: test
|
|
||||||
working-directory: build
|
|
||||||
run: make test
|
|
||||||
|
|
||||||
clang:
|
clang:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@ -53,39 +42,55 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: create build directory
|
- name: Run CMake (configure, build, test)
|
||||||
run: mkdir build
|
uses: ./.github/workflows/cmake
|
||||||
|
with:
|
||||||
|
cmake_build_type: ${{ matrix.build_type }}
|
||||||
|
cmake_cxx_compiler: clang++-${{ matrix.clang_version }}
|
||||||
|
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
||||||
|
|
||||||
- name: cmake configure
|
xcode:
|
||||||
working-directory: build
|
strategy:
|
||||||
run: cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DGSL_CXX_STANDARD=${{ matrix.cxx_version }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev -DCMAKE_CXX_COMPILER=clang++-${{ matrix.clang_version }} ..
|
matrix:
|
||||||
|
cxx_version: [ 17 ] # 14, 17, 20
|
||||||
|
build_type: [ 'Debug' ] # 'Debug', 'Release'
|
||||||
|
xcode_version: [ "15.4" ] # "14.3.1", "15.4"
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: build
|
- name: select xcode version
|
||||||
working-directory: build
|
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version }}.app
|
||||||
run: make
|
|
||||||
|
|
||||||
- name: test
|
- name: Run CMake (configure, build, test)
|
||||||
working-directory: build
|
uses: ./.github/workflows/cmake
|
||||||
run: make test
|
with:
|
||||||
|
cmake_build_type: ${{ matrix.build_type }}
|
||||||
|
cmake_cxx_compiler: clang++
|
||||||
|
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
||||||
|
|
||||||
VS_MSVC:
|
VisualStudio:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
cxx_version: [ 17 ] # 14, 17, 20
|
cxx_version: [ 17 ] # 14, 17, 20
|
||||||
generator: [ "Visual Studio 17 2022" ] # "Visual Studio 16 2019", "Visual Studio 17 2022"
|
generator: [ "Visual Studio 17 2022" ] # "Visual Studio 16 2019", "Visual Studio 17 2022"
|
||||||
build_type: [ 'Debug' ] # 'Debug', 'Release'
|
build_type: [ 'Debug' ] # 'Debug', 'Release'
|
||||||
|
extra_args: [ "", "-T ClangCL" ]
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Run CMake (configure only)
|
||||||
|
uses: ./.github/workflows/cmake
|
||||||
|
with:
|
||||||
|
cmake_generator: ${{ matrix.generator }}
|
||||||
|
cmake_build_type: ${{ matrix.build_type }}
|
||||||
|
cmake_configure_only: true
|
||||||
|
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
||||||
|
extra_cmake_args: ${{ matrix.extra_args }}
|
||||||
|
|
||||||
- uses: microsoft/setup-msbuild@v1
|
- uses: microsoft/setup-msbuild@v1
|
||||||
|
|
||||||
- name: create build directory
|
|
||||||
run: mkdir build
|
|
||||||
|
|
||||||
- name: cmake configure
|
|
||||||
working-directory: build
|
|
||||||
run: cmake -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DGSL_CXX_STANDARD=${{ matrix.cxx_version }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ..
|
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: msbuild GSL.sln
|
run: msbuild GSL.sln
|
||||||
|
Loading…
Reference in New Issue
Block a user