Merge pull request #58 from jnyfah/develop-2.0 #191
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 and Deploy C++ WebAssembly | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Emscripten | |
uses: mymindstorm/setup-emsdk@v11 | |
with: | |
version: latest | |
- name: Verify Emscripten Version | |
run: emcc -v | |
- name: Create Build Directory | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Configure CMake | |
working-directory: ${{github.workspace}}/build | |
run: emcmake cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
run: cmake --build . --config ${{env.BUILD_TYPE}} | |
- name: Run tests | |
working-directory: ${{github.workspace}}/build | |
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure | |
- name: Test WebAssembly with emrun | |
run: | | |
emrun --no_browser --port 8080 CompilerEditor/index.html & | |
sleep 10 | |
curl -sSf http://localhost:8080/index.html > /dev/null | |
kill %1 | |
- name: Deploy to GitHub Pages | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: CompilerEditor |