Use Ninja in CI #4
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: Build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
platform: [native, web] | |
build-type: [debug, release] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
submodules: false | |
# Install Vcpkg (submodule seems not working?) | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'microsoft/vcpkg' | |
path: 'vcpkg' | |
- name: Set strings | |
id: strings | |
run: | | |
echo "build-dir=${{ github.workspace }}/build" >> $GITHUB_OUTPUT | |
echo "build-dir-web=${{ github.workspace }}/build-wasm" >> $GITHUB_OUTPUT | |
- name: Bootstrap vcpkg | |
run: | | |
${{ github.workspace }}/vcpkg/bootstrap-vcpkg.sh | |
- name: Install CMake & Ninja on Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake ninja | |
- name: Install CMake & Ninja on macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install cmake ninja | |
- name: Install EMSDK | |
if: matrix.platform == 'web' | |
run: | | |
git clone https://github.com/emscripten-core/emsdk.git | |
${{ github.workspace }}/emsdk/emsdk install latest | |
${{ github.workspace }}/emsdk/emsdk activate latest | |
echo "EMSDK=${{ github.workspace }}/emsdk" >> $GITHUB_ENV | |
- name: CMake Configure for Native | |
if: matrix.platform == 'native' | |
run: > | |
cmake -G Ninja | |
-S ${{ github.workspace }} | |
-B ${{ steps.strings.outputs.build-dir }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} | |
- name: CMake Build for Native | |
if: matrix.platform == 'native' | |
run: cmake --build ${{ steps.strings.outputs.build-dir }} | |
- name: CMake Configure for Web | |
if: matrix.platform == 'web' | |
run: > | |
cmake -G Ninja | |
-S ${{ github.workspace }} | |
-B ${{ steps.strings.outputs.build-dir-web }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} | |
-DEMSCRIPTEN=ON | |
- name: CMake Build for Web | |
if: matrix.platform == 'web' | |
run: cmake --build ${{ steps.strings.outputs.build-dir-web }} |