GitHub Pages #89
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: GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build direct root playable game | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build root artifact | |
| run: bash scripts/build_web.sh dist | |
| - name: Verify direct root artifact | |
| run: | | |
| test -s dist/index.html | |
| test -s dist/neural_boundary_web.wasm | |
| grep -q "DIRECT ROOT RUN" dist/index.html | |
| grep -q "Run Game" dist/index.html | |
| grep -q "nbg_new" dist/index.html | |
| grep -q "nbg_tick" dist/index.html | |
| grep -q "nbg_set_action" dist/index.html | |
| grep -q "0x070900" dist/index.html | |
| - name: Verify WASM exports | |
| run: | | |
| node <<'NODE' | |
| const fs = require("fs"); | |
| WebAssembly.instantiate(fs.readFileSync("dist/neural_boundary_web.wasm"), {}).then(({instance}) => { | |
| const e = instance.exports; | |
| for (const n of ["nbg_abi_version","nbg_product_version_packed","nbg_health_check","nbg_new","nbg_tick","nbg_set_action","nbg_score","nbg_grade","nbg_state_hash_hi","nbg_state_hash_lo"]) { | |
| if (typeof e[n] !== "function") throw new Error("missing " + n); | |
| } | |
| if (e.nbg_abi_version() !== 3) throw new Error("bad ABI"); | |
| if (e.nbg_product_version_packed() !== 0x070900) throw new Error("bad version"); | |
| if (e.nbg_health_check() !== 0x070900) throw new Error("bad health"); | |
| if (e.nbg_new(1, 0x12345678, 0x9abcdef0) !== 1) throw new Error("new failed"); | |
| e.nbg_set_action(1); | |
| e.nbg_tick(); | |
| console.log("OK", e.nbg_score(), e.nbg_state_hash_hi(), e.nbg_state_hash_lo()); | |
| }).catch(e => { console.error(e); process.exit(1); }); | |
| NODE | |
| - uses: actions/configure-pages@v4 | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: dist | |
| deploy: | |
| name: Deploy direct root playable game | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 |