-
Notifications
You must be signed in to change notification settings - Fork 65
296 lines (242 loc) · 7.95 KB
/
main.yml
File metadata and controls
296 lines (242 loc) · 7.95 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
name: CI
on:
push:
paths-ignore: &ci_ignore_paths # Editor configs
- ".zed/**"
- ".vscode/**"
# Docs
- "documentation/**"
- "**/*.md"
# The README is included in the Typedoc
- "!README.md"
# Formatters
- "eslint.config.json"
- "prettier.config.json"
- ".editorconfig"
pull_request:
paths-ignore: *ci_ignore_paths
workflow_dispatch:
env:
WASM_BINDGEN_VERSION: "0.2.105"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build Scramjet
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "pnpm"
- name: Install pnpm dependencies
run: pnpm install
- name: Setup Rewriter Toolchain
uses: ./packages/scramjet/.github/actions/setup-rewriter-toolchain
with:
wasm-bindgen-version: ${{ env.WASM_BINDGEN_VERSION }}
rewriter-path: packages/scramjet/packages/core/rewriter
github-token: ${{ github.token }}
- name: Pack Scramjet
run: pnpm pack
working-directory: packages/scramjet/packages/core
- name: Pack Scramjet Controller
run: pnpm pack
working-directory: packages/scramjet/packages/controller
- name: Upload Artifact (scramjet/core)
uses: actions/upload-artifact@v4
with:
name: scramjet
path: packages/scramjet/packages/core/dist/*
- name: Upload Artifact (scramjet/core) (packaged)
uses: actions/upload-artifact@v4
with:
name: scramjet-package
path: packages/scramjet/packages/core/mercuryworkshop-scramjet-*.tgz
- name: Upload Artifact (scramjet/controller)
uses: actions/upload-artifact@v4
with:
name: scramjet-controller
path: packages/scramjet/packages/controller/dist/*
- name: Upload Artifact (scramjet/controller) (packaged)
uses: actions/upload-artifact@v4
with:
name: scramjet-controller-package
path: packages/scramjet/packages/controller/mercuryworkshop-scramjet-controller-*.tgz
package-validation:
name: Validate Package Structure
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Get artifacts
uses: actions/download-artifact@v4
with:
name: scramjet-package
path: packages/scramjet/packages/core
- name: Extract package
run: tar xvf mercuryworkshop-scramjet-*.tgz package --strip-components=1
working-directory: packages/scramjet/packages/core
- name: Run package validation tests
run: pnpm test:package
working-directory: packages/scramjet/packages/core
tests:
name: Run Scramjet Tests
runs-on: ubuntu-latest
needs: [build, package-validation]
env:
PLAYWRIGHT_BROWSERS_PATH: .playwright-browsers
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Get artifacts (scramjet/core)
uses: actions/download-artifact@v4
with:
name: scramjet
path: packages/scramjet/packages/core/dist
- name: Get artifacts (scramjet/controller)
uses: actions/download-artifact@v4
with:
name: scramjet-controller
path: packages/scramjet/packages/controller/dist
- name: Cache Playwright browsers
id: pw-browsers-cache
uses: actions/cache@v4
with:
path: .playwright-browsers
key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
playwright-${{ runner.os }}-
- name: Install Playwright Chromium
if: steps.pw-browsers-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps chromium
working-directory: packages/scramjet/packages/runway
- name: Run Runway tests
run: OMIT_WPT=1 pnpm test --parallel 4
working-directory: packages/scramjet/packages/runway
rewritertests:
name: Run Rewriter Tests
runs-on: ubuntu-latest
needs: [build, package-validation]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache Rust compilation
uses: Swatinem/rust-cache@v2
with:
workspaces: "packages/scramjet/packages/core/rewriter -> target"
cache-all-crates: true
shared-key: "rewriter"
- name: Run Tests
run: cargo test
working-directory: packages/scramjet/packages/core/rewriter/native
frontend:
name: Build Frontend
runs-on: ubuntu-latest
permissions: write-all
needs: [build, package-validation]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Get artifacts
uses: actions/download-artifact@v4
with:
name: scramjet
path: packages/scramjet/packages/core/dist
- name: Build Dreamland
run: pnpm build:dreamland
# - name: Get Chii submodule commit hash
# id: chii-hash
# run: echo "hash=$(git submodule status chii | awk '{print $1}')" >> $GITHUB_OUTPUT
# - name: Cache Chii build output
# id: chii-cache
# uses: actions/cache@v4
# with:
# path: |
# chii/public
# chii/front_end/dist
# key: chii-${{ runner.os }}-${{ steps.chii-hash.outputs.hash }}
# - name: Install Depot Tools
# if: steps.chii-cache.outputs.cache-hit != 'true'
# uses: newkdev/setup-depot-tools@v1.0.1
# - name: Initialize Chii front_end
# if: steps.chii-cache.outputs.cache-hit != 'true'
# run: |
# cd chii
# pnpm init:front_end
# - name: Build Chii
# if: steps.chii-cache.outputs.cache-hit != 'true'
# run: |
# cd chii
# pnpm build
- name: Build Frontend
run: |
SKIP_CORE=1 pnpm build
VITE_SENTRY_URL="https://js.sentry-cdn.com/89b0486bec1f3d54d07953d81a046161.min.js" VITE_PUTER_BRANDING=1 VITE_ISOLATION_ORIGIN="https://puter.zone" pnpm build:chrome
- name: Upload Artifact (frontend)
uses: actions/upload-artifact@v4
with:
name: frontend
path: |
./packages/chrome/dist
pages:
name: Upload to Github Pages
runs-on: ubuntu-latest
needs: [frontend, tests, rewritertests]
permissions: write-all
if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[PUBLISH]')
steps:
- name: Get artifacts
uses: actions/download-artifact@v4
with:
name: frontend
path: .
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: .
- name: Deploy to github
id: deployment
uses: actions/deploy-pages@v4