From e0f39ecb21fe74d59a18b600be3503d9577f52e7 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Fri, 26 Jun 2026 11:58:11 +0100 Subject: [PATCH 1/5] Split Justfile to allow building Wasm compiler example without serving --- packages/coln-compiler-wasm/justfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/coln-compiler-wasm/justfile b/packages/coln-compiler-wasm/justfile index d67454d..06c8e57 100644 --- a/packages/coln-compiler-wasm/justfile +++ b/packages/coln-compiler-wasm/justfile @@ -10,7 +10,7 @@ build: libdir="$(wasm32-wasi-ghc --print-libdir)" "$libdir/post-link.mjs" --input {{ dist_dir }}/coln.wasm --output {{ dist_dir }}/ghc_wasm_jsffi.js -serve-example port="8000": build +build-example: build #!/usr/bin/env bash set -euxo pipefail cp example.html {{ build_dir }}/index.html @@ -18,4 +18,6 @@ serve-example port="8000": build mkdir -p "$examples_dir" cp ../../packages/coln-compiler/test/*.coln "$examples_dir/" ls -1 "$examples_dir"/*.coln | xargs -n1 basename | jq -nR '[inputs]' > "$examples_dir/index.json" + +serve-example port="8000": build-example simple-http-server --nocache --index --open --port {{ port }} {{ build_dir }} From 00e7f04700cfc00bbae3d0dd87761602240799f9 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Fri, 26 Jun 2026 11:58:46 +0100 Subject: [PATCH 2/5] vibes-y first attempt to deploy Haskell compiler example --- .github/workflows/web-demo.yml | 46 ++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/.github/workflows/web-demo.yml b/.github/workflows/web-demo.yml index fde342b..f2f5c10 100644 --- a/.github/workflows/web-demo.yml +++ b/.github/workflows/web-demo.yml @@ -3,14 +3,14 @@ on: push: branches: [main] -name: Web demo +name: Web apps permissions: contents: read pull-requests: write concurrency: - group: web-demo-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} + group: web-apps-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: @@ -43,14 +43,34 @@ jobs: ~/.npm ~/.cargo/registry ~/.cargo/git + ~/.ghc-wasm/.cabal target - key: web-demo-${{ runner.os }}-${{ hashFiles('flake.lock', 'Cargo.lock', 'packages/coln-js-runtime/package-lock.json', 'examples/web-demo/pnpm-lock.yaml') }} + dist-newstyle + key: web-apps-${{ runner.os }}-${{ hashFiles('flake.lock', 'Cargo.lock', 'cabal.project', 'packages/**/*.cabal', 'packages/coln-js-runtime/package-lock.json', 'examples/web-demo/pnpm-lock.yaml') }} restore-keys: | - web-demo-${{ runner.os }}- + web-apps-${{ runner.os }}- - name: Build web demo run: nix run --accept-flake-config .#web-demo -- "$GITHUB_WORKSPACE" + - name: Build web compiler + run: nix develop --accept-flake-config --command just packages/coln-compiler-wasm/build-example + + - name: Assemble deploy directory + run: | + mkdir -p _deploy/demo _deploy/compiler + cp -r examples/web-demo/dist/* _deploy/demo/ + cp -r _build/wasm/* _deploy/compiler/ + cat > _deploy/index.html <<'EOF' + + + Coln + + EOF + - name: Deploy PR preview to Netlify id: deploy-preview if: github.event_name == 'pull_request' && env.NETLIFY_AUTH_TOKEN != '' && env.NETLIFY_SITE_ID != '' @@ -58,10 +78,10 @@ jobs: npx --yes netlify-cli@latest deploy \ --auth "$NETLIFY_AUTH_TOKEN" \ --site "$NETLIFY_SITE_ID" \ - --dir examples/web-demo/dist \ + --dir _deploy \ --no-build \ --alias "pr-${{ github.event.pull_request.number }}" \ - --message "PR #${{ github.event.pull_request.number }} web demo" \ + --message "PR #${{ github.event.pull_request.number }} web apps" \ --json > netlify-deploy.json cat netlify-deploy.json @@ -73,8 +93,14 @@ jobs: uses: actions/github-script@v8 with: script: | - const marker = '' - const body = `${marker}\nWeb demo preview: ${{ steps.deploy-preview.outputs.deploy-url }}` + const marker = '' + const url = '${{ steps.deploy-preview.outputs.deploy-url }}' + const body = [ + marker, + 'Deploy preview:', + `- [Demo](${url}/demo/)`, + `- [Compiler](${url}/compiler/)`, + ].join('\n') const { owner, repo } = context.repo const issue_number = context.issue.number const comments = await github.rest.issues.listComments({ owner, repo, issue_number, per_page: 100 }) @@ -91,7 +117,7 @@ jobs: npx --yes netlify-cli@latest deploy \ --auth "$NETLIFY_AUTH_TOKEN" \ --site "$NETLIFY_SITE_ID" \ - --dir examples/web-demo/dist \ + --dir _deploy \ --no-build \ --prod \ - --message "main web demo ${{ github.sha }}" + --message "main web apps ${{ github.sha }}" From 9cc910e367f5e61ce44f4df5d3aab284b8714328 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Fri, 26 Jun 2026 12:15:30 +0100 Subject: [PATCH 3/5] run Hackage update --- .github/workflows/web-demo.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/web-demo.yml b/.github/workflows/web-demo.yml index f2f5c10..577ad21 100644 --- a/.github/workflows/web-demo.yml +++ b/.github/workflows/web-demo.yml @@ -53,6 +53,9 @@ jobs: - name: Build web demo run: nix run --accept-flake-config .#web-demo -- "$GITHUB_WORKSPACE" + - name: Update wasm cabal package index + run: nix develop --accept-flake-config --command wasm32-wasi-cabal update + - name: Build web compiler run: nix develop --accept-flake-config --command just packages/coln-compiler-wasm/build-example From 6c2bf236c8b9b11e55bd28d0d18890e24e18652a Mon Sep 17 00:00:00 2001 From: George Thomas Date: Fri, 26 Jun 2026 12:15:41 +0100 Subject: [PATCH 4/5] Revert "run Hackage update" This reverts commit 9cc910e367f5e61ce44f4df5d3aab284b8714328. --- .github/workflows/web-demo.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/web-demo.yml b/.github/workflows/web-demo.yml index 577ad21..f2f5c10 100644 --- a/.github/workflows/web-demo.yml +++ b/.github/workflows/web-demo.yml @@ -53,9 +53,6 @@ jobs: - name: Build web demo run: nix run --accept-flake-config .#web-demo -- "$GITHUB_WORKSPACE" - - name: Update wasm cabal package index - run: nix develop --accept-flake-config --command wasm32-wasi-cabal update - - name: Build web compiler run: nix develop --accept-flake-config --command just packages/coln-compiler-wasm/build-example From 779edf23a5c8dceef591864d4feac7d537c16829 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Fri, 26 Jun 2026 14:04:23 +0100 Subject: [PATCH 5/5] try fixing original demo --- .github/workflows/web-demo.yml | 2 ++ examples/web-demo/vite.config.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/web-demo.yml b/.github/workflows/web-demo.yml index f2f5c10..b544028 100644 --- a/.github/workflows/web-demo.yml +++ b/.github/workflows/web-demo.yml @@ -52,6 +52,8 @@ jobs: - name: Build web demo run: nix run --accept-flake-config .#web-demo -- "$GITHUB_WORKSPACE" + env: + VITE_BASE: /demo/ - name: Build web compiler run: nix develop --accept-flake-config --command just packages/coln-compiler-wasm/build-example diff --git a/examples/web-demo/vite.config.ts b/examples/web-demo/vite.config.ts index 751b0ef..d704ced 100644 --- a/examples/web-demo/vite.config.ts +++ b/examples/web-demo/vite.config.ts @@ -7,6 +7,7 @@ import react from "@vitejs/plugin-react" import wasm from "vite-plugin-wasm" export default defineConfig({ + base: process.env.VITE_BASE || "/", plugins: [wasm(), react()], build: { target: "esnext" }, })