Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add emscripten build to the CI. #17

Merged
merged 15 commits into from
Mar 20, 2021
55 changes: 40 additions & 15 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@ jobs:
os: ubuntu-latest
cc: "gcc-9"
cxx: "g++-9"
cmake: "cmake"

- name: "Ubuntu Latest - Clang"
os: ubuntu-latest
cc: "clang-9"
cxx: "clang++-9"
cmake: "cmake"

- name: "Ubuntu Latest - Emscripten"
os: ubuntu-latest
cc: "emcc"
cxx: "em++"
cmake: "emcmake cmake"
steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-ninja@master
Expand All @@ -38,26 +47,42 @@ jobs:
with:
boost_version: 1.73.0

- name: Setup Emscripten
if: ${{ matrix.config.cc == 'emcc' }}
uses: mymindstorm/setup-emsdk@v7

- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: sudo apt install libboost-graph-dev

- name: CMake configure
- name: Build
run: >
cmake
-B build
-G Ninja
-DCMAKE_BUILD_TYPE=Debug
mkdir build;
${{ matrix.config.cmake }}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER=${{ matrix.config.cc }}
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }}
shell: bash

- name: cmake build
run: cmake --build build
shell: bash
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }};
make

- name: tests
run: |
cd build
- name: Tests
if: ${{ matrix.config.cc != 'emcc' }}
run: >
./input_output_test
shell: bash

- name: Make webAssembly distribution
if: ${{ matrix.config.cc == 'emcc' }}
run: >
mkdir -p distribution;
cp diagon.js distribution;
cp diagon.wasm distribution;
cp index.html distribution;
cp style.css distribution;
cp run_diagon.sh distribution;
chmod a+x ./distribution/run_diagon.sh

- name: Upload WebAssembly distribution
if: ${{ matrix.config.cc == 'emcc' }}
uses: actions/upload-artifact@v2
with:
name: distribution
path: distribution
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ if (EMSCRIPTEN)
foreach(file
"style.css"
"index.html"
"run_web_server.sh")
"run_diagon.sh")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/${file}
${CMAKE_CURRENT_BINARY_DIR}/${file}
Expand Down
6 changes: 6 additions & 0 deletions src/run_diagon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /bin/bash
python3 -m http.server 8888 &
P1=$!
trap 'kill 0' SIGINT; P1
python3 -m webbrowser http://localhost:8888
wait $P1
3 changes: 0 additions & 3 deletions src/run_web_server.sh

This file was deleted.