1name: deploy
2on:
3 push:
4 branches: [main]
5 workflow_dispatch:
7permissions:
8 contents: read
9 pages: write
10 id-token: write
12concurrency:
13 group: pages
14 cancel-in-progress: true
16jobs:
17 build-deploy:
18 runs-on: ubuntu-latest
19 environment:
20 name: github-pages
21 url: ${{ steps.deployment.outputs.page_url }}
22 steps:
23 - uses: actions/checkout@v4
24 - uses: actions/setup-node@v4
25 with:
26 node-version: 24
27 cache: npm
28 # numbl is a `file:../../numbl` dependency: we use its compiler internals
29 # (parser, lowerer, IR, inline pass) and its interpreter, which its
30 # published package `exports` do not expose. Clone it where that relative
31 # path expects it. Pinned so a change to those internals cannot silently
32 # break the build — the surface we rely on is written down in
33 # src/mgpu/numbl.d.ts.
34 #
35 # numbl's own dependencies are NOT needed: the slice we import is
36 # self-contained TypeScript, verified by building against a checkout with no
37 # node_modules. One file in it is generated rather than committed, though —
38 # the interpreter's stdlib bundle, which numbl gitignores — so a bare
39 # checkout is missing it and `executeCode.ts` fails to resolve it. Its
40 # generator only reads .m files off disk, so plain `node` (type-stripping,
41 # unflagged since 22.18) runs it without installing anything.
42 - name: Check out numbl (sibling dependency)
43 env:
44 NUMBL_REF: main
45 run: |
46 git clone --filter=blob:none --no-checkout \
47 https://github.com/flatironinstitute/numbl.git "$GITHUB_WORKSPACE/../../numbl"
48 git -C "$GITHUB_WORKSPACE/../../numbl" checkout --quiet "$NUMBL_REF"
49 node "$GITHUB_WORKSPACE/../../numbl/scripts/bundle-stdlib.ts"
50 # --ignore-scripts: npm runs a linked package's `prepare` script, and
51 # numbl's is husky, which is not installed here.
52 - run: npm ci --ignore-scripts
53 # The checks compile MATLAB to compute shaders, so they need a GPU; the
54 # browser suite below runs the same modules on SwiftShader if there is none.
55 - run: npm run test:node -- --skip-without-gpu
56 - run: npm run build
57 # Pages must already be enabled with "GitHub Actions" as the source; the
58 # workflow token cannot create the site itself (`enablement: true` fails
59 # with "Resource not accessible by integration").
60 - uses: actions/configure-pages@v5
61 - uses: actions/upload-pages-artifact@v3
62 with:
63 path: dist
64 - id: deployment
65 uses: actions/deploy-pages@v4