Skip to content

Commit 4e1b26f

Browse files
committed
ci: harden verification and Pages deployment
1 parent 97090d9 commit 4e1b26f

2 files changed

Lines changed: 65 additions & 8 deletions

File tree

.github/workflows/deploy-pages.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Deploy demo
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
concurrency:
10+
group: cad-viewer-production
11+
cancel-in-progress: false
12+
13+
jobs:
14+
deploy:
15+
name: Deploy Cloudflare Pages
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 15
18+
environment:
19+
name: production
20+
url: https://cad-viewer-iys.pages.dev
21+
env:
22+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
23+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 22
29+
cache: npm
30+
- run: npm ci
31+
- name: Require Cloudflare deployment credentials
32+
run: |
33+
test -n "$CLOUDFLARE_API_TOKEN"
34+
test -n "$CLOUDFLARE_ACCOUNT_ID"
35+
- run: npm run build:demo
36+
- run: npx wrangler pages deploy dist-demo --project-name cad-viewer --branch main
37+
- name: Verify production endpoints
38+
run: |
39+
curl --fail --show-error --silent --retry 5 --retry-all-errors https://cad-viewer-iys.pages.dev/ > /dev/null
40+
curl --fail --show-error --silent --retry 5 --retry-all-errors https://cad-viewer-iys.pages.dev/wasm/dwg-worker.js > /dev/null
41+
curl --fail --show-error --silent --retry 5 --retry-all-errors https://cad-viewer-iys.pages.dev/wasm/libredwg-web.wasm > /dev/null

.github/workflows/pages.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
1-
name: Deploy demo to Cloudflare Pages
1+
name: CI
22

33
on:
4-
workflow_dispatch:
54
push:
65
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ci-${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
715

816
jobs:
9-
deploy:
17+
verify:
18+
name: Verify package and demo
1019
runs-on: ubuntu-latest
20+
timeout-minutes: 15
1121
steps:
1222
- uses: actions/checkout@v4
1323
- uses: actions/setup-node@v4
1424
with:
15-
node-version: 20
25+
node-version: 22
1626
cache: npm
1727
- run: npm ci
28+
- run: npm run typecheck
29+
- run: npm test
1830
- run: npm run build:demo
19-
- run: npx wrangler pages deploy dist-demo --project-name cad-viewer
20-
env:
21-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
22-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
31+
- run: npm run check:wasm
32+
- run: npm run pack:dry
33+
- uses: actions/upload-artifact@v4
34+
with:
35+
name: cad-viewer-demo-${{ github.sha }}
36+
path: dist-demo
37+
if-no-files-found: error
38+
retention-days: 7

0 commit comments

Comments
 (0)