-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (51 loc) · 1.65 KB
/
Copy pathpages.yml
File metadata and controls
56 lines (51 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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 game from Rust/WASM core
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- run: bash scripts/build_web.sh dist
- name: Verify WASM exports from core
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_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_new(1, 0x12345678, 0x9abcdef0) !== 1) throw new Error("nbg_new failed");
e.nbg_set_action(1);
e.nbg_tick();
console.log("OK core wasm", 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 game from Rust/WASM core
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