Merge pull request #133 from mgerhold/open-recordings #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }}-${{ matrix.config.os-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
config: | |
- name: Windows MSVC Release | |
os: windows | |
os-version: 2022 | |
msvc: true | |
buildtype: Release | |
- name: Linux Release | |
os: ubuntu | |
os-version: 22.04 | |
buildtype: Release | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: "0" | |
- name: Setup MSVC | |
if: matrix.config.os == 'windows' && matrix.config.msvc == true | |
uses: TheMrMilchmann/setup-msvc-dev@v3 | |
with: | |
arch: x64 | |
toolset: 14.39 | |
- name: Install dependencies (Linux) | |
if: matrix.config.os == 'ubuntu' | |
shell: bash | |
run: | | |
sudo apt-get update | |
sudo apt install curl pkg-config zip unzip tar cmake git -y | |
- name: Install cmake >= 3.25 (Linux) | |
if: matrix.config.os == 'ubuntu' | |
shell: bash | |
run: | | |
sudo apt-get update | |
sudo apt-get install gpg wget | |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null | |
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null | |
sudo apt-get update | |
sudo apt-get install cmake -y | |
- name: Setup GCC (Linux) | |
if: matrix.config.os == 'ubuntu' | |
uses: egor-tensin/setup-gcc@v1 | |
with: | |
version: 13 | |
platform: x64 | |
- name: Install vcpkg | |
shell: bash | |
run: | | |
cd "${{github.workspace}}" | |
git clone https://github.com/Microsoft/vcpkg.git | |
"${{github.workspace}}/vcpkg/bootstrap-vcpkg.sh" | |
- uses: abdes/gha-setup-ninja@master | |
- name: Configure CMake (Windows only) | |
if: matrix.config.os == 'windows' | |
# 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 ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.config.buildtype }} -DCMAKE_TOOLCHAIN_FILE="${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake" ${{github.workspace}} -DVCPKG_TARGET_TRIPLET=x64-windows-static -G Ninja | |
- name: Configure CMake (Linux only) | |
if: matrix.config.os == 'ubuntu' | |
# 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 ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.config.buildtype }} -DCMAKE_TOOLCHAIN_FILE="${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake" ${{github.workspace}} -G Ninja | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build -j --config ${{ matrix.config.buildtype }} | |
- name: Upload artifacts - Linux | |
uses: actions/upload-artifact@v4 | |
if: matrix.config.os == 'ubuntu' | |
with: | |
name: ${{ matrix.config.name }} Executable | |
path: build/oopetris | |
- name: Upload artifacts - Windows | |
uses: actions/upload-artifact@v4 | |
if: matrix.config.os == 'windows' | |
with: | |
name: ${{ matrix.config.name }} Executable | |
path: build\oopetris.exe |