-
Notifications
You must be signed in to change notification settings - Fork 0
232 lines (209 loc) · 8.7 KB
/
Copy pathpages.yml
File metadata and controls
232 lines (209 loc) · 8.7 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: Deploy to GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
name: Build Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build CLI
run: go build -o guix ./cmd/guix
- name: Generate components for counter
run: ./guix generate -p examples/counter
- name: Generate components for calculator
run: ./guix generate -p examples/calculator
- name: Generate components for webgpu-chart
run: ./guix generate -p examples/webgpu-chart
- name: Copy wasm_exec.js
run: |
GOROOT="$(go env GOROOT)"
# Try lib/wasm first (Go 1.24+), then misc/wasm (older versions)
if [ -f "$GOROOT/lib/wasm/wasm_exec.js" ]; then
cp "$GOROOT/lib/wasm/wasm_exec.js" examples/counter/
cp "$GOROOT/lib/wasm/wasm_exec.js" examples/calculator/
cp "$GOROOT/lib/wasm/wasm_exec.js" examples/webgpu-cube/
cp "$GOROOT/lib/wasm/wasm_exec.js" examples/webgpu-chart/
elif [ -f "$GOROOT/misc/wasm/wasm_exec.js" ]; then
cp "$GOROOT/misc/wasm/wasm_exec.js" examples/counter/
cp "$GOROOT/misc/wasm/wasm_exec.js" examples/calculator/
cp "$GOROOT/misc/wasm/wasm_exec.js" examples/webgpu-cube/
cp "$GOROOT/misc/wasm/wasm_exec.js" examples/webgpu-chart/
else
echo "wasm_exec.js not found in GOROOT, downloading from GitHub"
curl -o examples/counter/wasm_exec.js https://raw.githubusercontent.com/golang/go/go1.25.0/lib/wasm/wasm_exec.js
curl -o examples/calculator/wasm_exec.js https://raw.githubusercontent.com/golang/go/go1.25.0/lib/wasm/wasm_exec.js
curl -o examples/webgpu-cube/wasm_exec.js https://raw.githubusercontent.com/golang/go/go1.25.0/lib/wasm/wasm_exec.js
curl -o examples/webgpu-chart/wasm_exec.js https://raw.githubusercontent.com/golang/go/go1.25.0/lib/wasm/wasm_exec.js
fi
- name: Build counter WASM
working-directory: examples/counter
run: GOOS=js GOARCH=wasm go build -o main.wasm .
- name: Build calculator WASM
working-directory: examples/calculator
run: GOOS=js GOARCH=wasm go build -o main.wasm .
- name: Build WebGPU cube WASM
working-directory: examples/webgpu-cube
run: GOOS=js GOARCH=wasm go build -o main.wasm .
- name: Build WebGPU chart WASM
working-directory: examples/webgpu-chart
run: GOOS=js GOARCH=wasm go build -o main.wasm .
- name: Create Pages structure
run: |
mkdir -p _site
mkdir -p _site/counter
mkdir -p _site/calculator
mkdir -p _site/webgpu-cube
mkdir -p _site/webgpu-chart
cp examples/counter/index.html _site/counter/
cp examples/counter/main.wasm _site/counter/
cp examples/counter/wasm_exec.js _site/counter/
cp examples/calculator/index.html _site/calculator/
cp examples/calculator/main.wasm _site/calculator/
cp examples/calculator/wasm_exec.js _site/calculator/
cp examples/webgpu-cube/index.html _site/webgpu-cube/
cp examples/webgpu-cube/main.wasm _site/webgpu-cube/
cp examples/webgpu-cube/wasm_exec.js _site/webgpu-cube/
cp examples/webgpu-chart/index.html _site/webgpu-chart/
cp examples/webgpu-chart/main.wasm _site/webgpu-chart/
cp examples/webgpu-chart/wasm_exec.js _site/webgpu-chart/
# Create index page with links to examples
cat > _site/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Guix Examples</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
max-width: 800px;
margin: 50px auto;
padding: 20px;
background: #f5f5f5;
}
.container {
background: white;
border-radius: 8px;
padding: 30px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 { color: #333; margin-top: 0; }
.examples {
list-style: none;
padding: 0;
}
.examples li {
margin: 15px 0;
}
.examples a {
display: block;
padding: 15px;
background: #007bff;
color: white;
text-decoration: none;
border-radius: 4px;
transition: background 0.2s;
}
.examples a:hover {
background: #0056b3;
}
.info {
background: #e3f2fd;
padding: 15px;
border-radius: 4px;
margin: 20px 0;
}
code {
background: #f5f5f5;
padding: 2px 6px;
border-radius: 3px;
font-family: 'Courier New', monospace;
}
</style>
</head>
<body>
<div class="container">
<h1>🚀 Guix Examples</h1>
<p><strong>Guix</strong> - Go-based UI language transpiling to WebAssembly</p>
<div class="info">
<h3>About Guix</h3>
<p>
Guix lets you write UI components in Go-like syntax that compile to WebAssembly.
Features include virtual DOM, reactive state, and type-safe event handling.
</p>
</div>
<h2>Live Examples</h2>
<ul class="examples">
<li>
<a href="./counter/">
<strong>Counter</strong> - Basic component with props and template interpolation
</a>
</li>
<li>
<a href="./calculator/">
<strong>Calculator</strong> - Interactive calculator with state management and event handlers
</a>
</li>
<li>
<a href="./webgpu-cube/">
<strong>WebGPU Rotating Cube</strong> - 3D graphics with WebGPU, scene graphs, and PBR materials
</a>
</li>
<li>
<a href="./webgpu-chart/">
<strong>WebGPU Chart</strong> - GPU-accelerated Bitcoin price candlestick chart
</a>
</li>
</ul>
<div class="info">
<h3>Browser Compatibility</h3>
<p>
<strong>Note:</strong> The WebGPU Cube and WebGPU Chart examples require a browser with WebGPU support
(Chrome 113+, Edge 113+, or other WebGPU-enabled browsers). The Counter and Calculator
examples work in all modern browsers.
</p>
</div>
<div class="info">
<h3>Learn More</h3>
<p>
Visit the <a href="https://github.com/gaarutyunov/guix">GitHub repository</a>
for documentation, source code, and more examples.
</p>
</div>
</div>
</body>
</html>
EOF
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: '_site'
deploy:
name: Deploy to GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4