diff --git a/.github/workflows/cmake/action.yml b/.github/workflows/cmake/action.yml new file mode 100644 index 0000000..bb84c63 --- /dev/null +++ b/.github/workflows/cmake/action.yml @@ -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 + diff --git a/.github/workflows/compilers.yml b/.github/workflows/compilers.yml index 2c8c334..696a762 100644 --- a/.github/workflows/compilers.yml +++ b/.github/workflows/compilers.yml @@ -10,14 +10,11 @@ on: pull_request: branches: [ main ] +# TODO (@carsonradtke) +# - [ ] flesh out strategy.matrix +# - [ ] Update README with latest versions actively tested +# - [ ] Do not use '*-latest' for runs-on jobs: - - # TODO (@carsonradtke) - # - [ ] Xcode - # - [ ] VS_LLVM - # - [ ] Update README with latest versions actively tested - # - [ ] Do not use '*-latest' for runs-on - gcc: strategy: matrix: @@ -28,21 +25,13 @@ jobs: steps: - uses: actions/checkout@v4 - - name: create build directory - run: mkdir build - - - name: cmake configure - working-directory: build - 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 }} .. - - - name: build - working-directory: build - run: make - - - name: test - working-directory: build - run: make test - + - name: Run CMake (configure, build, test) + uses: ./.github/workflows/cmake + with: + cmake_build_type: ${{ matrix.build_type }} + cmake_cxx_compiler: g++-${{ matrix.gcc_version }} + gsl_cxx_standard: ${{ matrix.cxx_version }} + clang: strategy: matrix: @@ -53,39 +42,55 @@ jobs: steps: - uses: actions/checkout@v4 - - name: create build directory - run: mkdir build + - name: Run CMake (configure, build, test) + 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 - working-directory: build - 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 }} .. + xcode: + strategy: + 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 - working-directory: build - run: make + - name: select xcode version + run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version }}.app - - name: test - working-directory: build - run: make test + - name: Run CMake (configure, build, test) + uses: ./.github/workflows/cmake + with: + cmake_build_type: ${{ matrix.build_type }} + cmake_cxx_compiler: clang++ + gsl_cxx_standard: ${{ matrix.cxx_version }} - VS_MSVC: + VisualStudio: strategy: matrix: cxx_version: [ 17 ] # 14, 17, 20 generator: [ "Visual Studio 17 2022" ] # "Visual Studio 16 2019", "Visual Studio 17 2022" build_type: [ 'Debug' ] # 'Debug', 'Release' + extra_args: [ "", "-T ClangCL" ] runs-on: windows-latest steps: - 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 - - 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 working-directory: build run: msbuild GSL.sln