Skip to content
# 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:
branches: [ "dev" ]
pull_request:
branches: [ "dev", "master" ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y mesa-common-dev mesa-utils libgl1-mesa-dev libx11-dev libxinerama-dev libxcursor-dev libxi-dev libxrandr-dev doxygen
sudo apt-get install -y libfreetype6-dev libudev-dev libopenal-dev libflac-dev libogg-dev libvorbis-dev
# Step to download Emsdk
- name: Download Emsdk
uses: actions/checkout@v3
with:
repository: emscripten-core/emsdk
path: 'emsdk'
# Step to install and activate the latest Emscripten SDK
- name: Install Emscripten
run: |
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
# Configure CMake with Emscripten toolchain
- name: Configure CMake for Emscripten
run: cmake -B ${{github.workspace}}/build-emscripten -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DMAZE_BUILD_WEB_EXAMPLES=ON
# Build with Emscripten
- name: Build with Emscripten
run: cmake --build ${{github.workspace}}/build-emscripten --config ${{env.BUILD_TYPE}}
# Configure CMake for default build (without Emscripten)
- name: Configure CMake for Default Build
run: cmake -B ${{github.workspace}}/build-default -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DMAZE_BUILD_DESKTOP_EXAMPLES=ON
- name: Build Default
run: cmake --build ${{github.workspace}}/build-default --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build-default
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}