Skip to content

Commit

Permalink
feat(ci): add build web action
Browse files Browse the repository at this point in the history
  • Loading branch information
RiscadoA committed Nov 22, 2024
1 parent b4ff2ce commit a4bdcc4
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: 🌐 Build Web

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

env:
BUILD_TYPE: Release
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: "${{ github.workspace }}/.ccache"
CCACHE_COMPILERTYPE: gcc
CMAKE_TOOLCHAIN_FILE: ${{ github.workspace }}/cmake/Emscripten.cmake

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Emscripten
uses: mymindstorm/setup-emsdk@v14

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install ccache
- name: Get timestamp
shell: bash
id: ccache_vars
run: |
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ env.CCACHE_COMPILERTYPE }}-${{ env.BUILD_TYPE }}-${{ github.ref }}-${{ steps.ccache_vars.outputs.timestamp }}
restore-keys: |
ccache-${{ env.CCACHE_COMPILERTYPE }}-${{ env.BUILD_TYPE }}-${{ github.ref }}-
ccache-${{ env.CCACHE_COMPILERTYPE }}-${{ env.BUILD_TYPE }}-
ccache-${{ env.CCACHE_COMPILERTYPE }}-
ccache-
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCUBOS_CORE_SAMPLES=ON -DCUBOS_ENGINE_SAMPLES=ON -DCMAKE_TOOLCHAIN_FILE=${{env.CMAKE_TOOLCHAIN_FILE}}
shell: bash
env:
CC: emcc
CXX: em++

- name: CCache Prolog
run: |-
ccache -s # Print current cache stats
ccache -z # Zero cache entry
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all

- name: CCache Epilog
run: |
ccache -s # Print current cache stats

0 comments on commit a4bdcc4

Please sign in to comment.