-
-
Notifications
You must be signed in to change notification settings - Fork 2
135 lines (115 loc) · 4.09 KB
/
Copy pathdeploy-viewer.yml
File metadata and controls
135 lines (115 loc) · 4.09 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Deploy viewer
# VW1-18 — build the WASM + the Vite site and publish to
# https://drunkonjava.github.io/rvt-rs/viewer/ via GitHub Pages.
# Runs on every push to main that touches viewer/ or src/ (so the
# WASM stays fresh), plus manual runs.
on:
push:
branches: [main]
paths:
- 'src/**'
- 'viewer/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/deploy-viewer.yml'
pull_request:
branches: [main]
paths:
- 'src/**'
- 'viewer/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/deploy-viewer.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Checkout public RVT sample corpus
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: phi-ag/rvt
path: _corpus
lfs: true
- name: Checkout public project corpus
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: magnetar-io/revit-test-datasets
path: _project_corpus
lfs: true
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@9399c7bb15d4c7d47b27263d024f0a4978346ba4 # v1.9.0
with:
toolchain: stable
# The action takes `target` (singular). wasm-pack will still
# `rustup target add wasm32-unknown-unknown` if this is
# missing — listing it here just saves one step.
target: wasm32-unknown-unknown
- name: Install wasm-pack
uses: jetli/wasm-pack-action@0d096b08b4e5a7de8c28de67e11e945404e9eefa # v0.4.0
with:
version: v0.14.0
- name: Install wabt (for Import-table audit)
run: sudo apt-get update && sudo apt-get install -y wabt
- name: Build WASM
# wasm-pack argument parsing is order-sensitive. Everything
# before `--` goes to wasm-pack; everything after goes to
# cargo. Default out-dir (`./pkg`) avoids an interaction
# where `--out-dir` after `--features` is forwarded to
# `cargo build`, which doesn't recognise it.
run: |
wasm-pack build --target web -- --features wasm --no-default-features
rm -rf viewer/pkg
mv pkg viewer/pkg
- name: Verify no network imports in wasm (VW1-21)
run: |
if wasm-objdump -j Import -x viewer/pkg/rvt_bg.wasm | \
grep -iE '"(fetch|XMLHttpRequest|WebSocket|EventSource|sendBeacon)"'; then
echo "::error::VW1-21 violation: wasm imports a network primitive"
exit 1
fi
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '20'
- name: Install dependencies
working-directory: viewer
run: npm ci
- name: Install Playwright Chromium
working-directory: viewer
run: npx playwright install --with-deps chromium
- name: Typecheck
working-directory: viewer
run: npm run typecheck
- name: Build viewer
working-directory: viewer
run: npm run build
- name: Browser regression tests
working-directory: viewer
env:
RVT_VIEWER_SAMPLE: ../_project_corpus/Revit/Revit_IFC5_Einhoven.rvt
run: npm run test:browser
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: viewer/dist
deploy:
if: github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 — real SHA from the v4 tag