Skip to content

Commit 49d5cb7

Browse files
Ajit Pratap SinghAjit Pratap Singh
authored andcommitted
fix(ci): build WASM before website build in Lighthouse CI
The postbuild script hashes public/wasm/gosqlx.wasm to stamp a content-addressed cache key into the service worker. Lighthouse CI was missing the Go + WASM build steps that website.yml already has, so the binary was absent and the build crashed with ENOENT. Added: Setup Go 1.26 → make build in wasm/ → copy binary to public/wasm/ Reverted the existsSync guard hack added in the previous commit. Bumped timeout to 15m to accommodate the Go build.
1 parent 1d22d5d commit 49d5cb7

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/lighthouse.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,22 @@ on:
1313
jobs:
1414
lighthouse:
1515
runs-on: ubuntu-latest
16-
timeout-minutes: 10
16+
timeout-minutes: 15
1717
steps:
1818
- uses: actions/checkout@v4
1919

20+
- name: Setup Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: '1.26'
24+
25+
- name: Build WASM
26+
run: |
27+
cd wasm && make build
28+
mkdir -p ../website/public/wasm
29+
cp playground/gosqlx.wasm ../website/public/wasm/
30+
cp playground/wasm_exec.js ../website/public/wasm/
31+
2032
- name: Setup Node
2133
uses: actions/setup-node@v4
2234
with:

website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"postbuild": "npm run update-sw-hash",
1010
"start": "next start",
1111
"analyze": "ANALYZE=true next build",
12-
"update-sw-hash": "node -e \"const {createHash} = require('crypto'); const fs = require('fs'); const wasmPath = 'public/wasm/gosqlx.wasm'; if (!fs.existsSync(wasmPath)) { console.log('WASM file not found, skipping SW cache key update'); process.exit(0); } const hash = createHash('sha256').update(fs.readFileSync(wasmPath)).digest('hex').slice(0,8); const sw = fs.readFileSync('public/wasm-sw.js','utf8').replace(/gosqlx-wasm-[a-f0-9-]+/, 'gosqlx-wasm-' + hash); fs.writeFileSync('public/wasm-sw.js', sw); console.log('SW cache key updated to: gosqlx-wasm-' + hash);\""
12+
"update-sw-hash": "node -e \"const {createHash} = require('crypto'); const fs = require('fs'); const hash = createHash('sha256').update(fs.readFileSync('public/wasm/gosqlx.wasm')).digest('hex').slice(0,8); const sw = fs.readFileSync('public/wasm-sw.js','utf8').replace(/gosqlx-wasm-[a-f0-9-]+/, 'gosqlx-wasm-' + hash); fs.writeFileSync('public/wasm-sw.js', sw); console.log('SW cache key updated to: gosqlx-wasm-' + hash);\""
1313
},
1414
"dependencies": {
1515
"@codemirror/lang-sql": "^6.10.0",

0 commit comments

Comments
 (0)