From 6a19371c9cc0f6d576ea8fc5ab6a620fbda2ed6a Mon Sep 17 00:00:00 2001 From: Tushar Maheshwari Date: Sun, 25 Jul 2021 23:01:45 +0530 Subject: [PATCH] Merge Documentation and Emscripten workflow (#166) Unify Documentation and Emscripten workflow --- .github/workflows/documentation.yaml | 34 ----------------------- .github/workflows/linux-emscripten.yaml | 37 +++++++++++++++++++++---- cmake/ftxui_set_options.cmake | 4 +-- 3 files changed, 34 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/documentation.yaml diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml deleted file mode 100644 index 8a9b0e5..0000000 --- a/.github/workflows/documentation.yaml +++ /dev/null @@ -1,34 +0,0 @@ -name: Documentation - -# Triggers the workflow on push events only for the master branch -on: - push: - branches: [ master ] - -jobs: - build-documentation: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install Doxygen/Graphviz - run: | - sudo apt-get update - sudo apt-get install doxygen graphviz - - - name: Build HTML documentation - run: | - cmake -S . -B build - cmake --build build --target doc - - # Deploy the HTML documentation to GitHub Pages - - name: GH Pages Deployment - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: build/doc/doxygen/html/ - enable_jekyll: false - allow_empty_commit: false - force_orphan: true - publish_branch: gh-pages diff --git a/.github/workflows/linux-emscripten.yaml b/.github/workflows/linux-emscripten.yaml index 1c60d40..e82f4c5 100644 --- a/.github/workflows/linux-emscripten.yaml +++ b/.github/workflows/linux-emscripten.yaml @@ -8,13 +8,40 @@ jobs: build: name: Linux Emscripten runs-on: ubuntu-latest + env: + DOCUMENTATION: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} steps: - uses: actions/checkout@v2 - uses: seanmiddleditch/gha-setup-ninja@master - uses: mymindstorm/setup-emsdk@v7 + + - name: Install Doxygen/Graphviz + if: fromJSON(env.DOCUMENTATION) + run: | + sudo apt-get update + sudo apt-get install doxygen graphviz + - name: Build - run: > - mkdir build; - cd build; - emcmake cmake ..; - cmake --build . --config Release; + run: | + emcmake cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S . -B build + cmake --build build + + - name: Build documentation + if: fromJSON(env.DOCUMENTATION) + run: | + cd build + cmake --build . --target doc + # Copy emscripten built examples to the doxygen output directory for deployment + rsync -amv --include='*/' --include='*.html' --include='*.js' --include='*.wasm' --exclude='*' examples doc/doxygen/html + + # Deploy the HTML documentation to GitHub Pages + - name: GH Pages Deployment + if: fromJSON(env.DOCUMENTATION) + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: build/doc/doxygen/html/ + enable_jekyll: false + allow_empty_commit: false + force_orphan: true + publish_branch: gh-pages diff --git a/cmake/ftxui_set_options.cmake b/cmake/ftxui_set_options.cmake index f40ff1a..9021cbc 100644 --- a/cmake/ftxui_set_options.cmake +++ b/cmake/ftxui_set_options.cmake @@ -48,8 +48,8 @@ endfunction() if (EMSCRIPTEN) #string(APPEND CMAKE_CXX_FLAGS " -s ASSERTIONS=1") - string(APPEND CMAKE_CXX_FLAGS " -s ASYNCIFY") string(APPEND CMAKE_CXX_FLAGS " -s USE_PTHREADS") - string(APPEND CMAKE_CXX_FLAGS " -s PROXY_TO_PTHREAD") + string(APPEND CMAKE_EXE_LINKER_FLAGS " -s ASYNCIFY") + string(APPEND CMAKE_EXE_LINKER_FLAGS " -s PROXY_TO_PTHREAD") endif()