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
name: Deploy dtact to GitHub Pages
# Merges the old benchmark.yml (Criterion + gh-pages) and the web deploy workflow.
# - build-bench: runs cargo bench, uploads criterion report as artifact
# - build-web: trunk build --release, uploads dist/ as artifact
# - deploy: downloads both artifacts, nests bench/ under dist/, then
# pushes a single GitHub Pages deployment
# / → dtact web frontend
# /bench/ → Criterion HTML report
on:
push:
branches:
paths:
- "web/**"
- "logo.svg"
- "src/**"
- "benches/**"
- "dtact-macros/**"
- ".github/workflows/deploy.yml"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
# ── Criterion benchmarks ─────────────────────────────────────────────────
build-bench:
name: Run Benchmarks
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- name: Cache Cargo registry + build
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Run Criterion benchmarks
run: cargo bench
- name: Upload criterion report artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: criterion-report
path: target/criterion
retention-days: 7
# ── Leptos/WASM web frontend ─────────────────────────────────────────────
build-web:
name: Build Web Frontend
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install Rust + wasm32 target
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
targets: wasm32-unknown-unknown
- name: Cache Cargo registry + web build
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
workspaces: web
- name: Install Trunk
run: cargo install trunk --locked
- name: Build Leptos app
working-directory: web
run: |
export TRUNK_TOOLS_WASM_BINDGEN="0.2.125"
trunk build --release -v
- name: Upload web dist artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: web-dist
path: web/dist
retention-days: 7
# ── Combine + deploy ─────────────────────────────────────────────────────
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Download web dist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: web-dist
path: dist
- name: Download Criterion report
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: criterion-report
path: dist/bench
- name: Upload combined Pages artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0