Parallel (#44) #18
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
# Adapted from: Simple workflow for deploying static content to GitHub Pages | |
name: Deploy to Pages | |
on: | |
push: | |
branches: ["master"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# Build the website | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/configure-pages@v4 | |
- 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: Install build dependencies | |
run: | | |
# LLVM 17 | |
wget https://apt.llvm.org/llvm.sh | |
chmod u+x ./llvm.sh | |
sudo ./llvm.sh 17 | |
# Raylib | |
sudo apt install libasound2-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxinerama-dev | |
# Emscripten | |
git clone https://github.com/emscripten-core/emsdk.git | |
cd emsdk | |
./emsdk install latest | |
./emsdk activate latest | |
- name: Configure CMake for Web | |
run: | | |
source "/home/runner/work/grass/grass/emsdk/emsdk_env.sh" | |
emcmake cmake -B ${{ steps.strings.outputs.build-output-dir }} \ | |
-DCMAKE_CXX_COMPILER=clang++-17 \ | |
-DCMAKE_C_COMPILER=clang-17 \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DPLATFORM=Web \ | |
-S ${{ github.workspace }} | |
- name: Build project grass | |
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target grass --config Release | |
- name: Clean up | |
working-directory: "${{ steps.strings.outputs.build-output-dir }}/demo" | |
run: | | |
rm -rf CMakeFiles cmake_install | |
mv grass.html index.html | |
- name: Emit artifacts | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "${{ steps.strings.outputs.build-output-dir }}/demo" | |
# As the name says, deploy the site. | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |