on master help sign in
Merge pull request #1462 from haskell-servant/upgrade-ghcjs
abc53b5Gaë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+14−34
@@ -123,33 +123,22 @@ jobs:
123 stack test --system-ghc
123 stack test --system-ghc
124
124
125 ghcjs:
125 ghcjs:
126− name: ubuntu-18.04 / ghcjs 8.4
126+ name: ubuntu-latest / ghcjs 8.6
127− runs-on: "ubuntu-18.04"
127+ runs-on: "ubuntu-latest"
128
128
129 steps:
129 steps:
130 - uses: actions/checkout@v2
130 - uses: actions/checkout@v2
131−
131+ - uses: cachix/install-nix-action@v13
132− - name: "Setup PATH"
132+ with:
133− run: |
133+ extra_nix_config: |
134− echo "PATH=$HOME/.cabal/bin:/opt/ghcjs/8.4/bin:$PATH" >> $GITHUB_ENV
134+ trusted-public-keys = ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=1aba6f367982bd6dd78ec2fda75ab246a62d32c5 cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
135−
135+ substituters = https://nixcache.reflex-frp.org https://cache.nixos.org/
136− - name: Install ghcjs and cabal
136+ - name: Setup
137 run: |
137 run: |
138− # Default GitHub image dropped ppa:hvr/ghc, so we add it ourselves
139− sudo add-apt-repository ppa:hvr/ghc
140− sudo add-apt-repository ppa:hvr/ghcjs
141− sudo apt-get update -y
142− sudo apt-get install ghcjs-8.4
143− sudo apt-get install cabal-install
144−
145 # Override cabal.project with the lightweight GHCJS one
138 # Override cabal.project with the lightweight GHCJS one
146 cp cabal.ghcjs.project cabal.project
139 cp cabal.ghcjs.project cabal.project
147 cat cabal.project
140 cat cabal.project
148−
149− - name: Cabal update and freeze
150− run: |
151− cabal v2-update
141+ nix-shell ghcjs.nix --run "cabal v2-update && cabal v2-freeze"
152− cabal v2-freeze
153
142
154 - uses: actions/cache@v2.1.3
143 - uses: actions/cache@v2.1.3
155 name: Cache ~/.cabal/store and dist-newstyle
144 name: Cache ~/.cabal/store and dist-newstyle
@@ -157,23 +146,14 @@ jobs:
157 path: |
146 path: |
158 ~/.cabal/store
147 ~/.cabal/store
159 dist-newstyle
148 dist-newstyle
160− key: ubuntu-18.04-ghcjs8.4-${{ hashFiles('cabal.project.freeze') }}
149+ key: ${{ runner.os }}-ghcjs8.6-${{ hashFiles('cabal.project.freeze') }}
161 restore-keys: |
150 restore-keys: |
162− ubuntu-18.04-ghcjs8.4-
151+ ${{ runner.os }}-ghcjs8.6-
163−
164− - name: Install cabal-plan and hspec-discover
165− run: |
166− cabal v2-install -w /opt/ghc/8.4.4/bin/ghc --ignore-project cabal-plan --constraint='cabal-plan ^>=0.6.0.0' --constraint='cabal-plan +exe'
167− cabal v2-install -w /opt/ghc/8.4.4/bin/ghc --ignore-project hspec-discover
168
152
169 - name: Build
153 - name: Build
170 run: |
154 run: |
171− cabal v2-build --ghcjs -w /opt/ghcjs/8.4/bin/ghcjs --enable-tests --enable-benchmarks all
155+ nix-shell ghcjs.nix --run "cabal v2-build --ghcjs --enable-tests --enable-benchmarks all"
172
156
173− - name: Run tests
157+ - name: Tests
174 run: |
158 run: |
175− # cabal v2-test does not work with GHCJS
159+ nix-shell ghcjs.nix --run ".github/run-ghcjs-tests.sh"
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
cabal.ghcjs.project+4−1
@@ -2,10 +2,13 @@
2
2
3packages:
3packages:
4 servant/
4 servant/
5+ servant-client/
5 servant-client-core/
6 servant-client-core/
6
7
7-- we need to tell cabal we are using GHCJS
8-- we need to tell cabal we are using GHCJS
8compiler: ghcjs
9compiler: ghcjs
9tests: True
10tests: True
10
11
12+-- Constraints so that reflex-platform provided packages are selected.
13+constraints: attoparsec == 0.13.2.2
11−constraints: hashable <=1.3.3.0
14+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;
servant-client-core/servant-client-core.cabal+1−1
@@ -17,7 +17,7 @@ maintainer: haskell-servant-maintainers@googlegroups.com
17copyright: 2014-2016 Zalora South East Asia Pte Ltd, 2016-2019 Servant Contributors
17copyright: 2014-2016 Zalora South East Asia Pte Ltd, 2016-2019 Servant Contributors
18build-type: Simple
18build-type: Simple
19tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
19tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
20− , GHCJS == 8.4
20+ , GHCJS ==8.6.0.1
21
21
22extra-source-files:
22extra-source-files:
23 CHANGELOG.md
23 CHANGELOG.md
servant-client/servant-client.cabal+5
@@ -21,6 +21,7 @@ maintainer: haskell-servant-maintainers@googlegroups.com
21copyright: 2014-2016 Zalora South East Asia Pte Ltd, 2016-2019 Servant Contributors
21copyright: 2014-2016 Zalora South East Asia Pte Ltd, 2016-2019 Servant Contributors
22build-type: Simple
22build-type: Simple
23tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
23tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
24+ , GHCJS ==8.6.0.1
24
25
25extra-source-files:
26extra-source-files:
26 CHANGELOG.md
27 CHANGELOG.md
@@ -82,6 +83,8 @@ test-suite spec
82 type: exitcode-stdio-1.0
83 type: exitcode-stdio-1.0
83 ghc-options: -Wall -rtsopts -threaded "-with-rtsopts=-T -N2"
84 ghc-options: -Wall -rtsopts -threaded "-with-rtsopts=-T -N2"
84 default-language: Haskell2010
85 default-language: Haskell2010
86+ if impl(ghcjs)
87+ buildable: False
85 hs-source-dirs: test
88 hs-source-dirs: test
86 main-is: Spec.hs
89 main-is: Spec.hs
87 other-modules:
90 other-modules:
@@ -137,3 +140,5 @@ test-suite readme
137 build-tool-depends: markdown-unlit:markdown-unlit
140 build-tool-depends: markdown-unlit:markdown-unlit
138 ghc-options: -pgmL markdown-unlit
141 ghc-options: -pgmL markdown-unlit
139 default-language: Haskell2010
142 default-language: Haskell2010
143+ if impl(ghcjs)
144+ buildable: False
servant/servant.cabal+1−1
@@ -21,7 +21,7 @@ copyright: 2014-2016 Zalora South East Asia Pte Ltd, 2016-2019 Servant
21build-type: Simple
21build-type: Simple
22
22
23tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
23tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
24− , GHCJS == 8.4
24+ , GHCJS ==8.6.0.1
25
25
26extra-source-files:
26extra-source-files:
27 CHANGELOG.md
27 CHANGELOG.md