Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ugai committed Nov 1, 2024
1 parent 9980990 commit 8d27cba
Showing 1 changed file with 52 additions and 50 deletions.
102 changes: 52 additions & 50 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ name: CMake on multiple platforms

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
workflow_dispatch:

jobs:
build:
Expand All @@ -22,63 +23,64 @@ jobs:
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
configuration: [
{os: ubuntu-latest, cpp_compiler: g++-13},
{os: windows-latest, cpp_compiler: cl},
]
configuration:
[
{ os: ubuntu-latest, cpp_compiler: g++-13 },
{ os: windows-latest, cpp_compiler: cl },
]
build_type: [Release]

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: actions/checkout@v4
with:
submodules: "recursive"

- 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: 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: Ubuntu 22.04 workaround
if: matrix.configuration.os == 'ubuntu-latest'
shell: bash
run: |
sudo apt update
sudo apt install -y libgtk-3-dev
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y g++-13
- name: Ubuntu 22.04 workaround
if: matrix.configuration.os == 'ubuntu-latest'
shell: bash
run: |
sudo apt update
sudo apt install -y libgtk-3-dev
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y g++-13
- name: Add msbuild to PATH
if: matrix.configuration.os == 'windows-latest'
uses: microsoft/[email protected]
- name: Add msbuild to PATH
if: matrix.configuration.os == 'windows-latest'
uses: microsoft/[email protected]

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Run vcpkg
uses: lukka/[email protected]
- name: Run vcpkg
uses: lukka/[email protected]

- 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.configuration.cpp_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- 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.configuration.cpp_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: 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 --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 }}
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# 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 }}

- name: Release
if: matrix.configuration.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
- name: Release
if: matrix.configuration.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2

0 comments on commit 8d27cba

Please sign in to comment.