This repository demonstrates how to very simply deploy GHCJS-based applications to GitHubPages, using Travis CI.
- Clone this repository, or drop its
.travis.yml
file into an existing repository. - Create a “Personal access tokens” on https://github.com/settings/tokens. Make sure it has the “repo“ permission.
- Go to the settings page of your repository on Travis
(e.g. https://travis-ci.org/nomeata/ghcjs2gh-pages/settings). Enable
Travis, if not done yet. Under “Environment Variables”, store the personal
access token from above, with name
GITHUB_TOKEN
. - Wait.
If everything works, you will be using your GHCJS program on the Github Page URL for this project, e.g. http://nomeata.github.io/ghcjs2gh-pages.
-
Why are you not using Stack or Nix?
This setup uses plain Cabal (no stack, no nix), not because Stack or Nix are bad tool, but to make this accessible to as many developers as possible. But ideally, it should not matter what happens on Travis.
-
I have too many dependencies, and the build times out.
If you trigger a build via the Travis web UI (top-right corner, “More Options” – “Trigger Build”), then travis will run an additional cache-warming stage where it will only build dependencies. This might help with the build. Let us know if this is still too slow, we have ideas.
-
What is this http://hackage-ghcjs-overlay.nomeata.de/ hackage source?
Some important GHCJS-related packages are not (yet) on hackage, including
reflex
andreflex-dom
. Until that is the case, I uploaded them to an overlay repository. -
Is the example program in this repository a good example of idiomatic
ghcjs-dom
use?No, surely not. I crudely forward-ported this demo that I wrote in 2015. If anyone wants to rewrite the
Main.hs
in this repository to follow best practices, that’d be amazing! -
Can I use my own domain name?
Yes. See https://help.github.com/articles/using-a-custom-domain-with-github-pages/ and set the domain name in the
fqdn
field in.travis.yaml
. -
Anyways, what’s the deal?
GHCJS is tricky to build, but thanks to hvr’s GHCJS PPA the pain is lessend.
-
Why
--constraint="primitive < 0.6.4.0
?Becuase of this bug: ghcjs/ghcjs#665
-
Document here how to do local development without GHCJS.
-
Find out and document how to handle data files that need to be available to the program, and/or data files that need to be available to the browser, in a way that works both locally (with GHC) and remotely (with GHCJS).
-
Clean up
Main.hs
(see question above). -
Also build the program using regular GHC on travis, to see if that works.
-
Build the test suite, if present, and only deploy if it passes.
Please reports bugs and missing features at the GitHub bugtracker. This is also where you can find the source code.
ghcjs2gh-pages
was written by Joachim Breitner and is licensed under a
permissive MIT license.