Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 51 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,25 @@ jobs:
uses: actions/checkout@v4

- name: install-nix
uses: DeterminateSystems/nix-installer-action@v15
uses: DeterminateSystems/nix-installer-action@v16

- name: gen-plan-json
id: gen-plan-json
run: |
nix develop --command bash -c 'cd frontend && wasm32-wasi-cabal update && wasm32-wasi-cabal build ghc-wasm-miso-examples --dry-run && echo WASM32_WASI_GHC=$(which wasm32-wasi-ghc) >> $GITHUB_OUTPUT'

- name: cabal-cache
uses: actions/cache@v4
with:
key: nix-${{ hashFiles('dist-newstyle/cache/plan.json') }}
restore-keys: nix-
path: |
~/.ghc-wasm/.cabal/store
dist-newstyle

- name: build-frontend
run: |
nix develop --command bash -c "cd frontend && wasm32-wasi-cabal update && exec ./build.sh --debuginfo --low-memory-unused --converge --gufa --flatten --rereloop -Oz"
nix develop --command bash -c "cd frontend && exec ./build.sh --low-memory-unused --converge --gufa --flatten --rereloop -Oz"

ghcup-build:
name: ghcup-build
Expand Down Expand Up @@ -52,15 +66,33 @@ jobs:

- uses: dw-labs-org/dart-sass-gha@v1

- name: build-frontend
- name: gen-plan-json
run: |
cd frontend
cabal \
--with-compiler=wasm32-wasi-ghc \
--with-hc-pkg=wasm32-wasi-ghc-pkg \
--with-hsc2hs=wasm32-wasi-hsc2hs \
update
./build.sh --debuginfo --low-memory-unused --converge --gufa --flatten --rereloop -Oz
cabal \
--with-compiler=wasm32-wasi-ghc \
--with-hc-pkg=wasm32-wasi-ghc-pkg \
--with-hsc2hs=wasm32-wasi-hsc2hs \
build ghc-wasm-miso-examples --dry-run

- name: cabal-cache
uses: actions/cache@v4
with:
key: ghcup-${{ hashFiles('dist-newstyle/cache/plan.json') }}
restore-keys: ghcup-
path: |
~/.local/state/cabal/store
dist-newstyle

- name: build-frontend
run: |
cd frontend
./build.sh --low-memory-unused --converge --gufa --flatten --rereloop -Oz

non-nix-build:
name: non-nix-build
Expand All @@ -85,10 +117,24 @@ jobs:

- uses: dw-labs-org/dart-sass-gha@v1

- name: gen-plan-json
run: |
cd frontend
wasm32-wasi-cabal build ghc-wasm-miso-examples --dry-run

- name: cabal-cache
uses: actions/cache@v4
with:
key: vanilla-${{ hashFiles('dist-newstyle/cache/plan.json') }}
restore-keys: vanilla-
path: |
~/.ghc-wasm/.cabal/store
dist-newstyle

- name: build-frontend
run: |
cd frontend
./build.sh --debuginfo --low-memory-unused --converge --gufa --flatten --rereloop -Oz
./build.sh --low-memory-unused --converge --gufa --flatten --rereloop -Oz

- name: upload-pages-artifact
uses: actions/upload-pages-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
packages: . hs2048

index-state: 2024-11-11T12:54:21Z
index-state: 2024-11-15T08:25:42Z

if arch(wasm32)
-- Required for TemplateHaskell. When using wasm32-wasi-cabal from
Expand Down
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ hs_wasm_path=$(find .. -name "*.wasm")
if $dev_mode; then
cp "$hs_wasm_path" dist/bin.wasm
else
wizer --allow-wasi --wasm-bulk-memory true --init-func _initialize -o dist/bin.wasm "$hs_wasm_path"
env -i GHCRTS=-H64m "$(type -P wizer)" --allow-wasi --wasm-bulk-memory true --inherit-env true --init-func _initialize -o dist/bin.wasm "$hs_wasm_path"
wasm-opt ${1+"$@"} dist/bin.wasm -o dist/bin.wasm
wasm-tools strip -o dist/bin.wasm dist/bin.wasm
fi
Expand Down
2 changes: 1 addition & 1 deletion frontend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { WASI, OpenFile, File, ConsoleStdout } from "https://cdn.jsdelivr.net/np
import ghc_wasm_jsffi from "./ghc_wasm_jsffi.js";

const args = [];
const env = [];
const env = ["GHCRTS=-H64m"];
const fds = [
new OpenFile(new File([])), // stdin
ConsoleStdout.lineBuffered((msg) => console.log(`[WASI stdout] ${msg}`)),
Expand Down