-
Notifications
You must be signed in to change notification settings - Fork 7
97 lines (77 loc) · 2.78 KB
/
pages.yml
File metadata and controls
97 lines (77 loc) · 2.78 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
name: pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
workspaces: compiler
- uses: dtolnay/rust-toolchain@stable
- name: Install wasm target
run: rustup target add wasm32-unknown-unknown
working-directory: compiler
- name: Install wasm-opt
run: |
curl -sSL https://github.com/WebAssembly/binaryen/releases/download/version_121/binaryen-version_121-x86_64-linux.tar.gz \
| tar -xz --strip-components=2 -C /usr/local/bin binaryen-version_121/bin/wasm-opt
wasm-opt --version
- name: Build wasm
run: cargo build --target wasm32-unknown-unknown --features wasm --lib --release
working-directory: compiler
- name: Size (unoptimized)
run: ls -lh target/wasm32-unknown-unknown/release/compiler_lib.wasm
working-directory: compiler
- name: Optimize wasm
run: |
INPUT=compiler/target/wasm32-unknown-unknown/release/compiler_lib.wasm
wasm-opt -Oz --converge \
--generate-global-effects \
--strip-debug --strip-producers \
--enable-bulk-memory-opt \
--enable-nontrapping-float-to-int \
--enable-sign-ext \
-tnh \
-o /tmp/wasm_stage1.wasm "$INPUT"
wasm-opt --flatten --rereloop -Oz -Oz \
--enable-bulk-memory-opt \
--enable-nontrapping-float-to-int \
--enable-sign-ext \
-o "$INPUT" /tmp/wasm_stage1.wasm
rm /tmp/wasm_stage1.wasm
- name: Write version manifest
run: |
HASH=$(sha256sum compiler/target/wasm32-unknown-unknown/release/compiler_lib.wasm \
| cut -c1-12)
printf '{"v":"%s"}\n' "$HASH" > demo/version.json
- name: Size (optimized)
run: ls -lh target/wasm32-unknown-unknown/release/compiler_lib.wasm
working-directory: compiler
- name: Stage demo
run: cp compiler/target/wasm32-unknown-unknown/release/compiler_lib.wasm demo/
- name: Setup Pages
uses: actions/configure-pages@v5
with:
enablement: true
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: demo
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4