name: Emscripten

on:
  push:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master

      - name: Checkout submodules
        run: git submodule update --init --recursive

      - name: Install emscripten
        run: ./tools/emscripten/install_emscripten.sh

      - name: Configure
        run: |
          source ~/emsdk/emsdk_env.sh
          mkdir build-emscripten
          cd build-emscripten
          emcmake cmake .. -DHELLOIMGUI_USE_SDL2=ON -DHELLOIMGUI_HAS_OPENGL3=ON

      - name: Build
        working-directory: build-emscripten
        run: |
          make -j 4
