Build / tests with GHCJS

This commit is contained in:
Gaël Deest 2021-03-17 12:11:03 +01:00
parent 579a372eb9
commit 95d4f5030f
2 changed files with 26 additions and 2 deletions

View file

@ -130,8 +130,33 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install ghcjs - name: Install ghcjs and tools
run: | run: |
sudo add-apt-repository ppa:hvr/ghcjs sudo add-apt-repository ppa:hvr/ghcjs
sudo apt-get update -y sudo apt-get update -y
sudo apt-get install ghcjs-8.4 sudo apt-get install ghcjs-8.4
sudo apt-get install cabal-install
cabal --version
# Override cabal.project with the lightweight GHCJS one
cp cabal.ghcjs.project cabal.project
cat cabal.project
export PATH=/opt/ghcjs/8.4.4/bin:$PATH
export PATH="$HOME/.cabal/bin:$PATH"
cabal v2-update
ls /opt
ls /opt/ghcjs/8.4/bin
# cabal v2-install --ghcjs -w /opt/ghcjs/8.4/bin/ghcjs --ignore-project hspec-discover
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
run: |
export PATH=/opt/ghcjs/8.4.4/bin:$PATH
export PATH="$HOME/.cabal/bin:$PATH"
cabal v2-build --ghcjs -w /opt/ghcjs/8.4/bin/ghcjs --enable-tests --enable-benchmarks all
- name: Run tests
run: |
export PATH="$HOME/.cabal/bin:$PATH"
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

View file

@ -3,7 +3,6 @@
packages: packages:
servant/ servant/
servant-client-core/ servant-client-core/
servant-jsaddle/
-- we need to tell cabal we are using GHCJS -- we need to tell cabal we are using GHCJS
compiler: ghcjs compiler: ghcjs