diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 74a932e..ede0b1a 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -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 @@ -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 + -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }}; + make - - name: cmake build - run: cmake --build build - shell: bash - - - 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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a8418d..da73093 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} diff --git a/src/run_diagon.sh b/src/run_diagon.sh new file mode 100755 index 0000000..488c23c --- /dev/null +++ b/src/run_diagon.sh @@ -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 diff --git a/src/run_web_server.sh b/src/run_web_server.sh deleted file mode 100755 index e11cc62..0000000 --- a/src/run_web_server.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/bash -python3 -m SimpleHTTPServer 8080 -