Merge pull request #2817 from GaijinEntertainment/bbatkin/qmacro-e-pe… #153
This file contains hidden or 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: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: | |
| # Only one Pages deployment at a time | |
| concurrency: | |
| group: pages-deploy | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest-fat | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: "SCM Checkout" | |
| uses: actions/checkout@v4 | |
| - name: "Install Python dependencies" | |
| run: | | |
| pip install -r doc/requirements.txt | |
| pip install markdown | |
| - name: "Install CMake and Ninja" | |
| uses: lukka/get-cmake@latest | |
| - name: "Build: Daslang (for das2rst)" | |
| run: | | |
| set -eux | |
| mkdir build | |
| cmake --no-warn-unused-cli -B./build \ | |
| -DCMAKE_BUILD_TYPE:STRING=Release \ | |
| -DDAS_HV_DISABLED=OFF \ | |
| -DDAS_PUGIXML_DISABLED=OFF \ | |
| -DDAS_LLVM_DISABLED=ON \ | |
| -DDAS_GLFW_DISABLED=ON \ | |
| -G Ninja | |
| cmake --build ./build --target daslang | |
| - name: "Run das2rst" | |
| run: | | |
| set -eux | |
| ./bin/daslang doc/reflections/das2rst.das | |
| - name: "Build Sphinx HTML" | |
| run: | | |
| sphinx-build -W --keep-going -b html -d doc/sphinx-build doc/source build/site | |
| - name: "Build Sphinx LaTeX" | |
| run: | | |
| sphinx-build -W --keep-going -b latex -d doc/sphinx-build doc/source build/latex | |
| - name: "Compile PDF: daslangstdlib.tex" | |
| uses: xu-cheng/latex-action@v4 | |
| with: | |
| root_file: daslangstdlib.tex | |
| working_directory: build/latex | |
| continue_on_error: true | |
| - name: "Compile PDF: daslang.tex" | |
| uses: xu-cheng/latex-action@v4 | |
| with: | |
| root_file: daslang.tex | |
| working_directory: build/latex | |
| continue_on_error: true | |
| - name: Setup Emscripten | |
| uses: emscripten-core/setup-emsdk@v11 | |
| with: | |
| # Pinned: 5.0.7's clang crashes on utils/dasFormatter/ds_parser.cpp | |
| # in diagnostic snippet rendering. 5.0.3 known-good. | |
| version: '5.0.3' | |
| - name: "Build WASM (Emscripten) for /playground/ + /files/wasm/" | |
| run: | | |
| set -eux | |
| cd web | |
| mkdir -p build && cd build | |
| emcmake cmake -DCMAKE_BUILD_TYPE=Release -G Ninja .. | |
| # daslang_static.wasm playground + stage_site_playground (vendored UI | |
| # + js/wasm) + stage_site_playground_wasm (cross-compiled examples). | |
| ninja daslang_static stage_site_playground stage_site_playground_wasm | |
| continue-on-error: true | |
| - name: "Fetch dasProfile per-platform benchmark JSONs" | |
| # dasProfile now ships a per-platform JSON file | |
| # (profile_results_<platform>.json). forge.js's bench cycler fetches | |
| # each one and renders a platform-list rail. Add `linux` to the loop | |
| # below when a Linux capture lands upstream. Missing-platform files | |
| # don't abort the build — the cycler silently drops them client-side. | |
| run: | | |
| set -eux | |
| for plat in darwin windows; do | |
| curl -sSL -o "site/files/profile_results_${plat}.json" \ | |
| "https://raw.githubusercontent.com/borisbat/dasProfile/main/profile_results_${plat}.json" \ | |
| || echo "WARNING: missing profile_results_${plat}.json" | |
| done | |
| continue-on-error: true | |
| - name: "Stage site for deployment" | |
| run: | | |
| set -eux | |
| mkdir -p _site | |
| # Static landing page and assets | |
| cp site/index.html _site/ | |
| cp site/downloads.html _site/ | |
| cp site/daspkg.html _site/ | |
| cp site/robots.txt _site/ | |
| cp -r site/files _site/files | |
| # Freshly-built Sphinx HTML docs | |
| cp -r build/site _site/doc | |
| # PDFs (referenced by index.html) | |
| cp build/latex/daslang.pdf _site/doc/daslang.pdf || echo "WARNING: daslang.pdf not found" | |
| cp build/latex/daslangstdlib.pdf _site/doc/daslangstdlib.pdf || echo "WARNING: daslangstdlib.pdf not found" | |
| # Blog + news + changelist (regenerated each publish). Pin --site-url | |
| # explicitly so feed.xml entries point at the production domain even | |
| # if the default in build_blog.py drifts. | |
| python3 site/blog/build_blog.py \ | |
| --posts site/blog/_posts \ | |
| --news site/_news \ | |
| --template site/blog/template.html \ | |
| --site-url https://daslang.io \ | |
| --out _site/ | |
| # Playground: vendor web/ui IDE + WASM artifacts. | |
| # The WASM build step has continue-on-error so docs/blog still publish | |
| # when emsdk hiccups. The cost of that resilience is partial state: | |
| # web/output may exist without the daslang_static.{js,wasm} artifacts. | |
| # Refuse to stage a half-built playground in that case — Pages preserves | |
| # the previously-deployed /playground/, so the visible Run button keeps | |
| # working instead of 404'ing its runtime. | |
| if [ -f web/output/daslang_static.js ] && [ -f web/output/daslang_static.wasm ]; then | |
| mkdir -p _site/playground _site/files/wasm | |
| # Copy IDE source files (CodeMirror, jQuery, main.js/css, etc.) | |
| cp -r web/examples/ui/src/* _site/playground/ | |
| # Copy WASM artifacts — known-present after the guard above. | |
| cp web/output/daslang_static.js _site/playground/ | |
| cp web/output/daslang_static.wasm _site/playground/ | |
| cp web/output/daslang_static.js _site/files/wasm/ | |
| cp web/output/daslang_static.wasm _site/files/wasm/ | |
| # Pull samples from site/playground/samples — that directory is the | |
| # single staged source of truth: stage_site_playground populates | |
| # the .das sources, stage_site_playground_wasm overlays the | |
| # cross-compiled .wasm artifacts. The HEAD probe in main.js | |
| # (updateEngineAvailability) enables the JIT radio only when the | |
| # .wasm is reachable, so dropping the .wasm here permanently | |
| # disables the toggle in production. | |
| cp -r site/playground/samples _site/playground/samples 2>/dev/null || true | |
| # Our Forge-skinned playground/index.html + skin CSS + init shim take precedence. | |
| # CodeMirror bundle (codemirror.min.js/css, simple-mode.js, daslang-*.js, | |
| # cm-forge.css) is served from /files/cm/ — copied via `cp -r site/files` | |
| # earlier, so nothing extra to copy here. | |
| cp site/playground/index.html _site/playground/index.html | |
| cp site/playground/forge-skin.css _site/playground/ | |
| # Forge playground scripts (init shim + tabs + share + splitter). | |
| # Glob so future playground-*.js additions land automatically. | |
| cp site/playground/playground-*.js _site/playground/ | |
| else | |
| # WASM artifacts missing. actions/deploy-pages publishes _site as | |
| # a complete snapshot (no layering over the prior deploy), so an | |
| # absent _site/playground/ would 404 the route. Stage a | |
| # placeholder instead — the URL keeps resolving to something | |
| # useful while we re-roll the runtime. | |
| echo "WARNING: daslang_static.{js,wasm} missing under web/output — staging placeholder /playground/." | |
| mkdir -p _site/playground | |
| cp site/playground/placeholder.html _site/playground/index.html | |
| fi | |
| # GitHub Pages control files | |
| touch _site/.nojekyll | |
| - name: "Upload Pages artifact" | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| - name: "Deploy to GitHub Pages" | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |