drag scroll #85
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: Emscripten build | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- "*" | |
paths: | |
# This action only runs on push when C++ files are changed | |
- "**.cpp" | |
- "**.h" | |
- "**.cmake" | |
- "**Lists.txt" | |
- "**-emscripten.yml" | |
workflow_dispatch: | |
env: | |
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules | |
jobs: | |
build: | |
name: Build and deploy | |
runs-on: macos-12 | |
steps: | |
- name: Install dependencies | |
run: | | |
brew install ninja emscripten | |
python3 -m pip install Pillow | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v3 | |
with: | |
path: "**/cpm_modules" | |
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | |
# Setup caching of build artifacts to reduce total build time (only Linux and MacOS) | |
- name: ccache | |
uses: hendrikmuhs/[email protected] | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Configure CMake | |
run: | | |
emcmake cmake -B ${{github.workspace}}/build -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --parallel 4 | |
- name: Archive build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifacts | |
path: | | |
${{github.workspace}}/build | |
- name: Copy web app | |
working-directory: ${{github.workspace}}/build | |
run: | | |
mkdir deploy | |
cp Samplin\ Safari.data Samplin\ Safari.html Samplin\ Safari.js Samplin\ Safari.wasm SamplinSafari_favicon.png FileSaver.js deploy/ | |
mv deploy/Samplin\ Safari.html deploy/index.html | |
- name: Publish | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
personal_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: gh-pages | |
publish_dir: ${{github.workspace}}/build/deploy |