git.iko.soy/typeable/servant
on master help sign in
Upgrade GHCJS to 8.6
910a3aeGaël Deest
.github/run-ghcjs-tests.shnew file+14
@@ -0,0 +1,14 @@
1+#!/usr/bin/env bash
2+#
3+# cabal v2-test does not work with GHCJS
4+# See: https://github.com/haskell/cabal/issues/6175
5+#
6+# This invokes cabal-plan to figure out test binaries, and invokes them with node.
7+
8+cabal-plan list-bins '*:test:*' | while read -r line
9+do
10+ testpkg=$(echo "$line" | perl -pe 's/:.*//')
11+ testexe=$(echo "$line" | awk '{ print $2 }')
12+ echo "testing $textexe in package $textpkg"
13+ (cd "$testpkg" && node "$testexe".jsexe/all.js)
14+done
.github/workflows/master.yml+36−4
@@ -172,8 +172,40 @@ jobs:
172
172
173 - name: Run tests
173 - name: Run tests
174 run: |
174 run: |
175− # cabal v2-test does not work with GHCJS
176− # See: https://github.com/haskell/cabal/issues/6175
177− #
178− # This invokes cabal-plan to figure out test binaries, and invokes them with node.
179 cabal-plan list-bins '*:test:*' | while read -r line; do testpkg=$(echo "$line" | perl -pe 's/:.*//'); testexe=$(echo "$line" | awk '{ print $2 }'); echo "testing $textexe in package $textpkg"; (cd "$(pkgdir $testpkg)" && nodejs "$testexe".jsexe/all.js); done
175 cabal-plan list-bins '*:test:*' | while read -r line; do testpkg=$(echo "$line" | perl -pe 's/:.*//'); testexe=$(echo "$line" | awk '{ print $2 }'); echo "testing $textexe in package $textpkg"; (cd "$(pkgdir $testpkg)" && nodejs "$testexe".jsexe/all.js); done
176+
177+ ghcjs-test:
178+ name: ghcjs-test
179+ runs-on: "ubuntu-latest"
180+
181+ steps:
182+ - uses: actions/checkout@v2
183+ - uses: cachix/install-nix-action@v13
184+ with:
185+ extra_nix_config: |
186+ trusted-public-keys = ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=1aba6f367982bd6dd78ec2fda75ab246a62d32c5 cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
187+ substituters = https://nixcache.reflex-frp.org https://cache.nixos.org/
188+ - name: Setup
189+ run: |
190+ # Override cabal.project with the lightweight GHCJS one
191+ cp cabal.ghcjs.project cabal.project
192+ cat cabal.project
193+ nix-shell ghcjs.nix --run "cabal v2-update && cabal v2-freeze"
194+
195+ - uses: actions/cache@v2.1.3
196+ name: Cache ~/.cabal/store and dist-newstyle
197+ with:
198+ path: |
199+ ~/.cabal/store
200+ dist-newstyle
201+ key: ${{ runner.os }}-ghcjs8.6-${{ hashFiles('cabal.project.freeze') }}
202+ restore-keys: |
203+ ${{ runner.os }}-ghcjs8.6-
204+
205+ - name: Build
206+ run: |
207+ nix-shell ghcjs.nix --run "cabal v2-build --ghcjs --enable-tests --enable-benchmarks all"
208+
209+ - name: Tests
210+ run: |
211+ nix-shell ghcjs.nix --run ".github/run-ghcjs-tests.sh"
cabal.ghcjs.project+3−1
@@ -8,4 +8,6 @@ packages:
8compiler: ghcjs
8compiler: ghcjs
9tests: True
9tests: True
10
10
11+-- Constraints so that reflex-platform provided packages are selected.
12+constraints: attoparsec == 0.13.2.2
11−constraints: hashable <=1.3.3.0
13+constraints: hashable == 1.3.0.0
ghcjs.nixnew file+22
@@ -0,0 +1,22 @@
1+let reflex-platform = import (builtins.fetchTarball
2+ { name = "reflex-platform";
3+ url = "https://github.com/reflex-frp/reflex-platform/archive/1aba6f367982bd6dd78ec2fda75ab246a62d32c5.tar.gz";
4+ }) {};
5+ pkgs = import ./nix/nixpkgs.nix; in
6+
7+pkgs.stdenv.mkDerivation {
8+ name = "ghcjs-shell";
9+ buildInputs =
10+ [ (reflex-platform.ghcjs.ghcWithPackages (p: with p; [
11+ attoparsec
12+ hashable
13+ ]))
14+ pkgs.cabal-install
15+ pkgs.gmp
16+ pkgs.haskellPackages.cabal-plan
17+ pkgs.haskellPackages.hspec-discover
18+ pkgs.nodejs
19+ pkgs.perl
20+ pkgs.zlib
21+ ];
22+}
nix/nixpkgs.nixnew file+4
@@ -0,0 +1,4 @@
1+import (builtins.fetchTarball {
2+ url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/21.05.tar.gz";
3+ sha256 = "sha256:1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36";
4+}) {}
nix/shell.nix+1−5
@@ -1,10 +1,6 @@
1−let nixos = fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/21.05.tar.gz";
2− sha256 = "sha256:1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36";
3−}; in
4−
5{ compiler ? "ghc8104"
1{ compiler ? "ghc8104"
6, tutorial ? false
2, tutorial ? false
7−, pkgs ? import nixos { config = {}; }
3+, pkgs ? import ./nixpkgs.nix
8}:
4}:
9
5
10 with pkgs;
6 with pkgs;