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

**URL:** <https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651>\
**Category:** Learn\
**Created:** [January 26, 2024, 11:43am UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651 "2024-01-26T11:43:56Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidB](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/davidb/32/3616_2.png) [@DavidB](https://discourse.haskell.org/u/DavidB)\
**Post date:** [January 26, 2024, 11:43am UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651/1 "2024-01-26T11:43:56Z")

</div>

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](https://engineering.iog.io/2023-01-24-javascript-browser-tutorial/) 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 🙂 , 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.

---

<div class="post-metadata">

**Author:** ![hasufell](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/hasufell/32/1250_2.png) [@hasufell](https://discourse.haskell.org/u/hasufell)\
**Post date:** [January 26, 2024, 3:01pm UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651/2 "2024-01-26T15:01:01Z")

</div>

> [@DavidB](#):
>
> prebuilt binaries

- [https://www.haskell.org/ghcup/guide/#cross-support](https://www.haskell.org/ghcup/guide/#cross-support)
- [ghcup-metadata/ghcup-cross-0.0.8.yaml at develop · haskell/ghcup-metadata · GitHub](https://github.com/haskell/ghcup-metadata/blob/develop/ghcup-cross-0.0.8.yaml)

May not be the latest.

---

<div class="post-metadata">

**Author:** ![brandonchinn178](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/brandonchinn178/32/5103_2.png) [@brandonchinn178](https://discourse.haskell.org/u/brandonchinn178)\
**Post date:** [January 26, 2024, 4:54pm UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651/3 "2024-01-26T16:54:53Z")

</div>

[fourmolu.github.io](http://fourmolu.github.io) uses GHCJS. You can use Ormolu or Fourmolu’s CI as inspiration if you get stuck

---

<div class="post-metadata">

**Author:** ![hasufell](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/hasufell/32/1250_2.png) [@hasufell](https://discourse.haskell.org/u/hasufell)\
**Post date:** [January 27, 2024, 5:53am UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651/4 "2024-01-27T05:53:19Z")

</div>

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](https://github.com/fourmolu/fourmolu/blob/a769b64c80b49497be965286a0ddd6e6482c7bfc/.github/workflows/web.yml#L28)

---

<div class="post-metadata">

**Author:** ![brandonchinn178](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/brandonchinn178/32/5103_2.png) [@brandonchinn178](https://discourse.haskell.org/u/brandonchinn178)\
**Post date:** [January 27, 2024, 9:02am UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651/5 "2024-01-27T09:02:25Z")

</div>

🤦 sorry I’m dumb, ignore me

---

<div class="post-metadata">

**Author:** ![hsyl20](https://avatars.discourse-cdn.com/v4/letter/h/b4bc9f/32.png) [@hsyl20](https://discourse.haskell.org/u/hsyl20)\
**Post date:** [January 29, 2024, 3:53pm UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651/6 "2024-01-29T15:53:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hasufell](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/hasufell/32/1250_2.png) [@hasufell](https://discourse.haskell.org/u/hasufell)\
**Post date:** [January 29, 2024, 4:26pm UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651/7 "2024-01-29T16:26:45Z")

</div>

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

You add a section like:

```haskell
    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.

---

<div class="post-metadata">

**Author:** ![hsyl20](https://avatars.discourse-cdn.com/v4/letter/h/b4bc9f/32.png) [@hsyl20](https://discourse.haskell.org/u/hsyl20)\
**Post date:** [January 29, 2024, 5:11pm UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651/8 "2024-01-29T17:11:05Z")

</div>

Thanks.

> The storage should be permanent. So avoid gitlab URIs.

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

---

<div class="post-metadata">

**Author:** ![hasufell](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/hasufell/32/1250_2.png) [@hasufell](https://discourse.haskell.org/u/hasufell)\
**Post date:** [January 29, 2024, 5:13pm UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651/9 "2024-01-29T17:13:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hsyl20](https://avatars.discourse-cdn.com/v4/letter/h/b4bc9f/32.png) [@hsyl20](https://discourse.haskell.org/u/hsyl20)\
**Post date:** [January 30, 2024, 10:28am UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651/10 "2024-01-30T10:28:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DavidB](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/davidb/32/3616_2.png) [@DavidB](https://discourse.haskell.org/u/DavidB)\
**Post date:** [February 13, 2024, 6:23pm UTC](https://discourse.haskell.org/t/how-can-i-use-ghcs-javascript-backend-in-github-ci/8651/11 "2024-02-13T18:23:37Z")

</div>

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](https://github.com/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](https://github.com/haskell-actions/setup)
