How can I use GHC's Javascript backend in Github CI

The Javascript backend has been merged into the GHC repo for a while, and I also found the tutorial on how to build a simple example here: Using GHC's JavaScript Backend in the Browser | IOG Engineering But has anyone already tried to build a static site using Github actions which can be served using github pages? Building GHC itself using Github actions is probably not the way to go forward :slight_smile: , but is there some preferred way to get prebuilt binaries?

Ideally I am looking for someone who has a working Github actions configuration for building and serving a simple static website that I can copy and modify.

5 Likes

May not be the latest.

3 Likes

fourmolu.github.io uses GHCJS. You can use Ormolu or Fourmolu’s CI as inspiration if you get stuck

2 Likes

It doesn’t look like it’s using GHCJS, it’s using wasm: https://github.com/fourmolu/fourmolu/blob/a769b64c80b49497be965286a0ddd6e6482c7bfc/.github/workflows/web.yml#L28

1 Like

🤦 sorry I’m dumb, ignore me

What’s the process to update the unofficial bindist to 9.8?

You just send a PR editing this file: https://github.com/haskell/ghcup-metadata/blob/f6ef3672bad8f53790f9dc26503b4d62763a6918/ghcup-cross-0.0.8.yaml#L9

You add a section like:

    javascript-unknown-ghcjs-9.8.1:
      viTags:
      - base-XXXXXX
      viArch:
        A_64:
          Linux_UnknownLinux:
            unknown_versioning:
              dlUri: <uri>/ghc-javascript-unknown-ghcjs-9.8.1-x86_64-linux-unknown.tar.xz
              dlHash: <hash>
              dlSubdir: ghc-9.8.1-javascript-unknown-ghcjs
          Darwin:
            unknown_versioning:
              dlUri: <uri>/ghc-javascript-unknown-ghcjs-9.8.1-x86_64-apple-darwin.tar.xz
              dlHash: <hash>
              dlSubdir: ghc-9.8.1-javascript-unknown-ghcjs
        A_ARM64:
          Darwin:
            unknown_versioning:
              dlUri: <uri>/ghc-javascript-unknown-ghcjs-9.8.1-aarch64-apple-darwin.tar.xz
              dlHash: <hash>
              dlSubdir: ghc-9.8.1-javascript-unknown-ghcjs

The storage should be permanent. So avoid gitlab URIs.

Thanks.

The storage should be permanent. So avoid gitlab URIs.

Could we store the new bindists with the other unofficial ones?

yeah…If you give me a download location, I can move them there

Ok we’ll do this for the upcoming 9.8.2 release. Thanks!

1 Like

For anyone stumbling upon this in the future. I managed to find some time today to try this out. I created the following minimal project which uses GHCup’s support for crosscompilers in GitHub CI actions: GitHub - BinderDavid/ghc-javascript-ci

Since this was so easy, the next step would probably be to support the javascript crosscompiler in the official haskell setup actions: GitHub - haskell-actions/setup: Setting up GHC, cabal, stack on for Haskell-related CIs

2 Likes