From 357ab69839bf136ea0f2984f2b7541856821cf63 Mon Sep 17 00:00:00 2001 From: "Justin Goshi (from Dev Box)" Date: Tue, 1 Aug 2023 11:10:55 -1000 Subject: [PATCH 1/6] Split cmake starter workflow single/multi plaform --- ci/cmake-multi-platform.yml | 60 +++++++++++++++++++++ ci/{cmake.yml => cmake-single-platform.yml} | 4 +- ci/properties/cmake-multi-platform.json | 6 +++ ci/properties/cmake-single-platform.json | 6 +++ ci/properties/cmake.properties.json | 6 --- 5 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 ci/cmake-multi-platform.yml rename ci/{cmake.yml => cmake-single-platform.yml} (83%) create mode 100644 ci/properties/cmake-multi-platform.json create mode 100644 ci/properties/cmake-single-platform.json delete mode 100644 ci/properties/cmake.properties.json diff --git a/ci/cmake-multi-platform.yml b/ci/cmake-multi-platform.yml new file mode 100644 index 0000000..70475c1 --- /dev/null +++ b/ci/cmake-multi-platform.yml @@ -0,0 +1,60 @@ +# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml +name: CMake on a multiple platforms + +on: + push: + branches: [ $default-branch ] + pull_request: + branches: [ $default-branch ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Can consider changing this to true when the workflow is stable. + fail-fast: false + + # Set up a matrix to run the following 3 configurations: + # 1. + # 2. + # 3. + # + # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. + matrix: + os: [ubuntu-latest, windows-latest] + build_type: [Release] + compiler: [gcc, clang, cl] + exclude: + - os: windows-latest + compiler: gcc + - os: windows-latest + compiler: clang + - os: ubuntu-latest + compiler: cl + + steps: + - uses: actions/checkout@v3 + + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + id: strings + shell: bash + run: | + echo "build-output-dir=${{github.workspace}}/build" >> "$GITHUB_OUTPUT" + + - 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 ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_C_COMPILER=${{matrix.compiler}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -S ${{github.workspace}} + + - name: Build + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + 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. Note that -C is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -C ${{matrix.build_type}} diff --git a/ci/cmake.yml b/ci/cmake-single-platform.yml similarity index 83% rename from ci/cmake.yml rename to ci/cmake-single-platform.yml index 95d7efd..ccc318b 100644 --- a/ci/cmake.yml +++ b/ci/cmake-single-platform.yml @@ -1,4 +1,6 @@ -name: CMake +# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml +name: CMake on a single platform on: push: diff --git a/ci/properties/cmake-multi-platform.json b/ci/properties/cmake-multi-platform.json new file mode 100644 index 0000000..d26e2c2 --- /dev/null +++ b/ci/properties/cmake-multi-platform.json @@ -0,0 +1,6 @@ +{ + "name": "CMake based multi-platform projects", + "description": "Build and test a CMake based project on multiple platforms.", + "iconName": "cmake", + "categories": ["Continuous integration", "C", "C++"] +} \ No newline at end of file diff --git a/ci/properties/cmake-single-platform.json b/ci/properties/cmake-single-platform.json new file mode 100644 index 0000000..f843cf9 --- /dev/null +++ b/ci/properties/cmake-single-platform.json @@ -0,0 +1,6 @@ +{ + "name": "CMake based single-platform projects", + "description": "Build and test a CMake based project on a single-platform.", + "iconName": "cmake", + "categories": ["Continuous integration", "C", "C++"] +} \ No newline at end of file diff --git a/ci/properties/cmake.properties.json b/ci/properties/cmake.properties.json deleted file mode 100644 index a7f5d06..0000000 --- a/ci/properties/cmake.properties.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "CMake based projects", - "description": "Build and test a CMake based project.", - "iconName": "cmake", - "categories": ["Continuous integration", "C", "C++"] -} \ No newline at end of file From 12e30f58ecfd8ceac12a2f97fecd52d5011ceff8 Mon Sep 17 00:00:00 2001 From: "Justin Goshi (from Dev Box)" Date: Thu, 3 Aug 2023 12:00:16 -1000 Subject: [PATCH 2/6] Address a few comments on the PR --- ci/cmake-multi-platform.yml | 27 ++++++++++++++++++------ ci/properties/cmake-multi-platform.json | 2 +- ci/properties/cmake-single-platform.json | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/ci/cmake-multi-platform.yml b/ci/cmake-multi-platform.yml index 70475c1..a520c1a 100644 --- a/ci/cmake-multi-platform.yml +++ b/ci/cmake-multi-platform.yml @@ -25,14 +25,24 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] build_type: [Release] - compiler: [gcc, clang, cl] + c_compiler: [gcc, clang, cl] + include: + - os: windows-latest + c_compiler: cl + cpp_compiler: cl + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ exclude: - os: windows-latest - compiler: gcc + c_compiler: gcc - os: windows-latest - compiler: clang + c_compiler: clang - os: ubuntu-latest - compiler: cl + c_compiler: cl steps: - uses: actions/checkout@v3 @@ -47,7 +57,12 @@ jobs: - 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 ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_C_COMPILER=${{matrix.compiler}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -S ${{github.workspace}} + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_CXX_COMPILER=${{matrix.cpp_compiler}} + -DCMAKE_C_COMPILER=${{matrix.c_compiler}} + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} + -S ${{github.workspace}} - name: Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). @@ -57,4 +72,4 @@ jobs: working-directory: ${{ steps.strings.outputs.build-output-dir }} # Execute tests defined by the CMake configuration. Note that -C is needed because the default Windows generator is a multi-config generator (Visual Studio generator). # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C ${{matrix.build_type}} + run: ctest --build-config ${{matrix.build_type}} diff --git a/ci/properties/cmake-multi-platform.json b/ci/properties/cmake-multi-platform.json index d26e2c2..ef44fcf 100644 --- a/ci/properties/cmake-multi-platform.json +++ b/ci/properties/cmake-multi-platform.json @@ -1,5 +1,5 @@ { - "name": "CMake based multi-platform projects", + "name": "CMake based, multi-platform projects", "description": "Build and test a CMake based project on multiple platforms.", "iconName": "cmake", "categories": ["Continuous integration", "C", "C++"] diff --git a/ci/properties/cmake-single-platform.json b/ci/properties/cmake-single-platform.json index f843cf9..8c7260e 100644 --- a/ci/properties/cmake-single-platform.json +++ b/ci/properties/cmake-single-platform.json @@ -1,5 +1,5 @@ { - "name": "CMake based single-platform projects", + "name": "CMake based, single-platform projects", "description": "Build and test a CMake based project on a single-platform.", "iconName": "cmake", "categories": ["Continuous integration", "C", "C++"] From 34455614ec3d864812ebfe35d7576aca6c4359ec Mon Sep 17 00:00:00 2001 From: "Justin Goshi (from Dev Box)" Date: Thu, 3 Aug 2023 12:37:25 -1000 Subject: [PATCH 3/6] Grammar changes --- ci/cmake-multi-platform.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/cmake-multi-platform.yml b/ci/cmake-multi-platform.yml index a520c1a..dd5e5c4 100644 --- a/ci/cmake-multi-platform.yml +++ b/ci/cmake-multi-platform.yml @@ -1,6 +1,6 @@ # This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml -name: CMake on a multiple platforms +name: CMake on multiple platforms on: push: @@ -13,7 +13,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: - # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Can consider changing this to true when the workflow is stable. + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. fail-fast: false # Set up a matrix to run the following 3 configurations: From ed1d73eb989689c28f93b74aa9a6fdaf49c3819c Mon Sep 17 00:00:00 2001 From: "Justin Goshi (from Dev Box)" Date: Fri, 4 Aug 2023 06:37:11 -1000 Subject: [PATCH 4/6] Respond to PR comments --- ci/cmake-multi-platform.yml | 14 +++++++------- ci/properties/cmake-multi-platform.json | 2 +- ci/properties/cmake-single-platform.json | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ci/cmake-multi-platform.yml b/ci/cmake-multi-platform.yml index dd5e5c4..774ba90 100644 --- a/ci/cmake-multi-platform.yml +++ b/ci/cmake-multi-platform.yml @@ -52,24 +52,24 @@ jobs: id: strings shell: bash run: | - echo "build-output-dir=${{github.workspace}}/build" >> "$GITHUB_OUTPUT" + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - 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 ${{ steps.strings.outputs.build-output-dir }} - -DCMAKE_CXX_COMPILER=${{matrix.cpp_compiler}} - -DCMAKE_C_COMPILER=${{matrix.c_compiler}} - -DCMAKE_BUILD_TYPE=${{matrix.build_type}} - -S ${{github.workspace}} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} - name: Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{matrix.build_type}} + 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. Note that -C is needed because the default Windows generator is a multi-config generator (Visual Studio generator). # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest --build-config ${{matrix.build_type}} + run: ctest --build-config ${{ matrix.build_type }} diff --git a/ci/properties/cmake-multi-platform.json b/ci/properties/cmake-multi-platform.json index ef44fcf..59d1b47 100644 --- a/ci/properties/cmake-multi-platform.json +++ b/ci/properties/cmake-multi-platform.json @@ -3,4 +3,4 @@ "description": "Build and test a CMake based project on multiple platforms.", "iconName": "cmake", "categories": ["Continuous integration", "C", "C++"] -} \ No newline at end of file +} diff --git a/ci/properties/cmake-single-platform.json b/ci/properties/cmake-single-platform.json index 8c7260e..c0aa074 100644 --- a/ci/properties/cmake-single-platform.json +++ b/ci/properties/cmake-single-platform.json @@ -3,4 +3,4 @@ "description": "Build and test a CMake based project on a single-platform.", "iconName": "cmake", "categories": ["Continuous integration", "C", "C++"] -} \ No newline at end of file +} From d7abf7d27d13ea9a8eba671df8f020cab44849fa Mon Sep 17 00:00:00 2001 From: "Justin Goshi (from Dev Box)" Date: Fri, 4 Aug 2023 14:58:59 -1000 Subject: [PATCH 5/6] Fix a comment --- ci/cmake-multi-platform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/cmake-multi-platform.yml b/ci/cmake-multi-platform.yml index 774ba90..e0bcb55 100644 --- a/ci/cmake-multi-platform.yml +++ b/ci/cmake-multi-platform.yml @@ -70,6 +70,6 @@ jobs: - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} - # Execute tests defined by the CMake configuration. Note that -C is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ctest --build-config ${{ matrix.build_type }} From d7000e06a1d535765f66a1a85e31384a66a3460e Mon Sep 17 00:00:00 2001 From: "Justin Goshi (from Dev Box)" Date: Wed, 9 Aug 2023 14:15:51 -1000 Subject: [PATCH 6/6] Fix errors found with CI validation checks. --- ci/cmake-multi-platform.yml | 2 +- ...multi-platform.json => cmake-multi-platform.properties.json} | 0 ...ngle-platform.json => cmake-single-platform.properties.json} | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename ci/properties/{cmake-multi-platform.json => cmake-multi-platform.properties.json} (100%) rename ci/properties/{cmake-single-platform.json => cmake-single-platform.properties.json} (100%) diff --git a/ci/cmake-multi-platform.yml b/ci/cmake-multi-platform.yml index e0bcb55..8762e9f 100644 --- a/ci/cmake-multi-platform.yml +++ b/ci/cmake-multi-platform.yml @@ -13,7 +13,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: - # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. fail-fast: false # Set up a matrix to run the following 3 configurations: diff --git a/ci/properties/cmake-multi-platform.json b/ci/properties/cmake-multi-platform.properties.json similarity index 100% rename from ci/properties/cmake-multi-platform.json rename to ci/properties/cmake-multi-platform.properties.json diff --git a/ci/properties/cmake-single-platform.json b/ci/properties/cmake-single-platform.properties.json similarity index 100% rename from ci/properties/cmake-single-platform.json rename to ci/properties/cmake-single-platform.properties.json