From 95d4f5030f1cc1b078d26843b789ca3c13f2c8a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Deest?= Date: Wed, 17 Mar 2021 12:11:03 +0100 Subject: [PATCH] Build / tests with GHCJS --- .github/workflows/main.yml | 27 ++++++++++++++++++++++++++- cabal.ghcjs.project | 1 - 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7c97895c..68c5d6ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -130,8 +130,33 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install ghcjs + - name: Install ghcjs and tools run: | 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 + 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 diff --git a/cabal.ghcjs.project b/cabal.ghcjs.project index d7f2c49f..11ceb957 100644 --- a/cabal.ghcjs.project +++ b/cabal.ghcjs.project @@ -3,7 +3,6 @@ packages: servant/ servant-client-core/ - servant-jsaddle/ -- we need to tell cabal we are using GHCJS compiler: ghcjs