Skip to content

Commit 0a706c8

Browse files
ReadycodeAIclaude
andcommitted
Run the tests on GitHub, and publish the browser demo with GitHub Pages once Pages is switched on
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent bfce503 commit 0a706c8

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

‎.github/workflows/demo.yml‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Builds the browser demo (web/) and publishes it with GitHub Pages.
2+
# It only runs once Pages is switched on for this repository
3+
# (Settings > Pages > Source: GitHub Actions), or when started by hand.
4+
name: demo
5+
6+
on:
7+
push:
8+
branches: [main]
9+
paths: ["web/**", "src/core.cjs", "package.json", "package-lock.json"]
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: pages
19+
cancel-in-progress: true
20+
21+
jobs:
22+
deploy:
23+
if: github.event_name == 'workflow_dispatch' || github.event.repository.has_pages
24+
runs-on: ubuntu-latest
25+
environment:
26+
name: github-pages
27+
url: ${{ steps.deployment.outputs.page_url }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: 20
33+
cache: npm
34+
- run: npm ci
35+
- run: npm run build:web
36+
- uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: web/dist
39+
- id: deployment
40+
uses: actions/deploy-pages@v4

‎.github/workflows/test.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
node: [20, 22]
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: ${{ matrix.node }}
19+
cache: npm
20+
- run: npm ci
21+
- run: npm test
22+
- run: npm run build:web

‎web/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ npm run build:web # writes web/dist: index.html, reader-web.js, pdf.worker.
88
```
99

1010
Host the three files in `web/dist` on any static site (they must be served over http(s), not opened as a file). No server code is needed, so it costs nothing however many people use it.
11+
12+
This repository publishes it automatically with GitHub Pages ([`.github/workflows/demo.yml`](../.github/workflows/demo.yml)) once Pages is switched on (Settings > Pages > Source: GitHub Actions). Every change to `web/` or the engine is then rebuilt and republished.

0 commit comments

Comments
 (0)