Merge pull request #1462 from haskell-servant/upgrade-ghcjs
Upgrade GHCJS
This commit is contained in:
commit
abc53b54e3
9 changed files with 66 additions and 42 deletions
14
.github/run-ghcjs-tests.sh
vendored
Executable file
14
.github/run-ghcjs-tests.sh
vendored
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# cabal v2-test does not work with GHCJS
|
||||||
|
# See: https://github.com/haskell/cabal/issues/6175
|
||||||
|
#
|
||||||
|
# This invokes cabal-plan to figure out test binaries, and invokes them with node.
|
||||||
|
|
||||||
|
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 "$testpkg" && node "$testexe".jsexe/all.js)
|
||||||
|
done
|
48
.github/workflows/master.yml
vendored
48
.github/workflows/master.yml
vendored
|
@ -123,33 +123,22 @@ jobs:
|
||||||
stack test --system-ghc
|
stack test --system-ghc
|
||||||
|
|
||||||
ghcjs:
|
ghcjs:
|
||||||
name: ubuntu-18.04 / ghcjs 8.4
|
name: ubuntu-latest / ghcjs 8.6
|
||||||
runs-on: "ubuntu-18.04"
|
runs-on: "ubuntu-latest"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
- uses: cachix/install-nix-action@v13
|
||||||
- name: "Setup PATH"
|
with:
|
||||||
|
extra_nix_config: |
|
||||||
|
trusted-public-keys = ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=1aba6f367982bd6dd78ec2fda75ab246a62d32c5 cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
|
||||||
|
substituters = https://nixcache.reflex-frp.org https://cache.nixos.org/
|
||||||
|
- name: Setup
|
||||||
run: |
|
run: |
|
||||||
echo "PATH=$HOME/.cabal/bin:/opt/ghcjs/8.4/bin:$PATH" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Install ghcjs and cabal
|
|
||||||
run: |
|
|
||||||
# Default GitHub image dropped ppa:hvr/ghc, so we add it ourselves
|
|
||||||
sudo add-apt-repository ppa:hvr/ghc
|
|
||||||
sudo add-apt-repository ppa:hvr/ghcjs
|
|
||||||
sudo apt-get update -y
|
|
||||||
sudo apt-get install ghcjs-8.4
|
|
||||||
sudo apt-get install cabal-install
|
|
||||||
|
|
||||||
# Override cabal.project with the lightweight GHCJS one
|
# Override cabal.project with the lightweight GHCJS one
|
||||||
cp cabal.ghcjs.project cabal.project
|
cp cabal.ghcjs.project cabal.project
|
||||||
cat cabal.project
|
cat cabal.project
|
||||||
|
nix-shell ghcjs.nix --run "cabal v2-update && cabal v2-freeze"
|
||||||
- name: Cabal update and freeze
|
|
||||||
run: |
|
|
||||||
cabal v2-update
|
|
||||||
cabal v2-freeze
|
|
||||||
|
|
||||||
- uses: actions/cache@v2.1.3
|
- uses: actions/cache@v2.1.3
|
||||||
name: Cache ~/.cabal/store and dist-newstyle
|
name: Cache ~/.cabal/store and dist-newstyle
|
||||||
|
@ -157,23 +146,14 @@ jobs:
|
||||||
path: |
|
path: |
|
||||||
~/.cabal/store
|
~/.cabal/store
|
||||||
dist-newstyle
|
dist-newstyle
|
||||||
key: ubuntu-18.04-ghcjs8.4-${{ hashFiles('cabal.project.freeze') }}
|
key: ${{ runner.os }}-ghcjs8.6-${{ hashFiles('cabal.project.freeze') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
ubuntu-18.04-ghcjs8.4-
|
${{ runner.os }}-ghcjs8.6-
|
||||||
|
|
||||||
- name: Install cabal-plan and hspec-discover
|
|
||||||
run: |
|
|
||||||
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'
|
|
||||||
cabal v2-install -w /opt/ghc/8.4.4/bin/ghc --ignore-project hspec-discover
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cabal v2-build --ghcjs -w /opt/ghcjs/8.4/bin/ghcjs --enable-tests --enable-benchmarks all
|
nix-shell ghcjs.nix --run "cabal v2-build --ghcjs --enable-tests --enable-benchmarks all"
|
||||||
|
|
||||||
- name: Run tests
|
- name: Tests
|
||||||
run: |
|
run: |
|
||||||
# cabal v2-test does not work with GHCJS
|
nix-shell ghcjs.nix --run ".github/run-ghcjs-tests.sh"
|
||||||
# See: https://github.com/haskell/cabal/issues/6175
|
|
||||||
#
|
|
||||||
# This invokes cabal-plan to figure out test binaries, and invokes them with node.
|
|
||||||
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
|
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
servant/
|
servant/
|
||||||
|
servant-client/
|
||||||
servant-client-core/
|
servant-client-core/
|
||||||
|
|
||||||
-- we need to tell cabal we are using GHCJS
|
-- we need to tell cabal we are using GHCJS
|
||||||
compiler: ghcjs
|
compiler: ghcjs
|
||||||
tests: True
|
tests: True
|
||||||
|
|
||||||
constraints: hashable <=1.3.3.0
|
-- Constraints so that reflex-platform provided packages are selected.
|
||||||
|
constraints: attoparsec == 0.13.2.2
|
||||||
|
constraints: hashable == 1.3.0.0
|
||||||
|
|
22
ghcjs.nix
Normal file
22
ghcjs.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
let reflex-platform = import (builtins.fetchTarball
|
||||||
|
{ name = "reflex-platform";
|
||||||
|
url = "https://github.com/reflex-frp/reflex-platform/archive/1aba6f367982bd6dd78ec2fda75ab246a62d32c5.tar.gz";
|
||||||
|
}) {};
|
||||||
|
pkgs = import ./nix/nixpkgs.nix; in
|
||||||
|
|
||||||
|
pkgs.stdenv.mkDerivation {
|
||||||
|
name = "ghcjs-shell";
|
||||||
|
buildInputs =
|
||||||
|
[ (reflex-platform.ghcjs.ghcWithPackages (p: with p; [
|
||||||
|
attoparsec
|
||||||
|
hashable
|
||||||
|
]))
|
||||||
|
pkgs.cabal-install
|
||||||
|
pkgs.gmp
|
||||||
|
pkgs.haskellPackages.cabal-plan
|
||||||
|
pkgs.haskellPackages.hspec-discover
|
||||||
|
pkgs.nodejs
|
||||||
|
pkgs.perl
|
||||||
|
pkgs.zlib
|
||||||
|
];
|
||||||
|
}
|
4
nix/nixpkgs.nix
Normal file
4
nix/nixpkgs.nix
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
import (builtins.fetchTarball {
|
||||||
|
url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/21.05.tar.gz";
|
||||||
|
sha256 = "sha256:1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36";
|
||||||
|
}) {}
|
|
@ -1,10 +1,6 @@
|
||||||
let nixos = fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/21.05.tar.gz";
|
|
||||||
sha256 = "sha256:1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36";
|
|
||||||
}; in
|
|
||||||
|
|
||||||
{ compiler ? "ghc8104"
|
{ compiler ? "ghc8104"
|
||||||
, tutorial ? false
|
, tutorial ? false
|
||||||
, pkgs ? import nixos { config = {}; }
|
, pkgs ? import ./nixpkgs.nix
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
|
@ -17,7 +17,7 @@ maintainer: haskell-servant-maintainers@googlegroups.com
|
||||||
copyright: 2014-2016 Zalora South East Asia Pte Ltd, 2016-2019 Servant Contributors
|
copyright: 2014-2016 Zalora South East Asia Pte Ltd, 2016-2019 Servant Contributors
|
||||||
build-type: Simple
|
build-type: Simple
|
||||||
tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
|
tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
|
||||||
, GHCJS == 8.4
|
, GHCJS ==8.6.0.1
|
||||||
|
|
||||||
extra-source-files:
|
extra-source-files:
|
||||||
CHANGELOG.md
|
CHANGELOG.md
|
||||||
|
|
|
@ -21,6 +21,7 @@ maintainer: haskell-servant-maintainers@googlegroups.com
|
||||||
copyright: 2014-2016 Zalora South East Asia Pte Ltd, 2016-2019 Servant Contributors
|
copyright: 2014-2016 Zalora South East Asia Pte Ltd, 2016-2019 Servant Contributors
|
||||||
build-type: Simple
|
build-type: Simple
|
||||||
tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
|
tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
|
||||||
|
, GHCJS ==8.6.0.1
|
||||||
|
|
||||||
extra-source-files:
|
extra-source-files:
|
||||||
CHANGELOG.md
|
CHANGELOG.md
|
||||||
|
@ -82,6 +83,8 @@ test-suite spec
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
ghc-options: -Wall -rtsopts -threaded "-with-rtsopts=-T -N2"
|
ghc-options: -Wall -rtsopts -threaded "-with-rtsopts=-T -N2"
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
if impl(ghcjs)
|
||||||
|
buildable: False
|
||||||
hs-source-dirs: test
|
hs-source-dirs: test
|
||||||
main-is: Spec.hs
|
main-is: Spec.hs
|
||||||
other-modules:
|
other-modules:
|
||||||
|
@ -137,3 +140,5 @@ test-suite readme
|
||||||
build-tool-depends: markdown-unlit:markdown-unlit
|
build-tool-depends: markdown-unlit:markdown-unlit
|
||||||
ghc-options: -pgmL markdown-unlit
|
ghc-options: -pgmL markdown-unlit
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
if impl(ghcjs)
|
||||||
|
buildable: False
|
||||||
|
|
|
@ -21,7 +21,7 @@ copyright: 2014-2016 Zalora South East Asia Pte Ltd, 2016-2019 Servant
|
||||||
build-type: Simple
|
build-type: Simple
|
||||||
|
|
||||||
tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
|
tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1
|
||||||
, GHCJS == 8.4
|
, GHCJS ==8.6.0.1
|
||||||
|
|
||||||
extra-source-files:
|
extra-source-files:
|
||||||
CHANGELOG.md
|
CHANGELOG.md
|
||||||
|
|
Loading…
Reference in a new issue