@@ -123,33 +123,22 @@ jobs:
123123 stack test --system-ghc
124124
125125 ghcjs:
126− name: ubuntu-18.04 / ghcjs 8.4
127− runs-on: "ubuntu-18.04"
126+ name: ubuntu-latest / ghcjs 8.6
127+ runs-on: "ubuntu-latest"
128128
129129 steps:
130130 - uses: actions/checkout@v2
131−
132− - name: "Setup PATH"
133− run: |
134− echo "PATH=$HOME/.cabal/bin:/opt/ghcjs/8.4/bin:$PATH" >> $GITHUB_ENV
135−
136− - name: Install ghcjs and cabal
131+ - uses: cachix/install-nix-action@v13
132+ with:
133+ extra_nix_config: |
134+ trusted-public-keys = ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=1aba6f367982bd6dd78ec2fda75ab246a62d32c5 cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
135+ substituters = https://nixcache.reflex-frp.org https://cache.nixos.org/
136+ - name: Setup
137137 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−
145138 # Override cabal.project with the lightweight GHCJS one
146139 cp cabal.ghcjs.project cabal.project
147140 cat cabal.project
148−
149− - name: Cabal update and freeze
150− run: |
151− cabal v2-update
152− cabal v2-freeze
141+ nix-shell ghcjs.nix --run "cabal v2-update && cabal v2-freeze"
153142
154143 - uses: actions/cache@v2.1.3
155144 name: Cache ~/.cabal/store and dist-newstyle
@@ -157,23 +146,14 @@ jobs:
157146 path: |
158147 ~/.cabal/store
159148 dist-newstyle
160− key: ubuntu-18.04-ghcjs8.4-${{ hashFiles('cabal.project.freeze') }}
149+ key: ${{ runner.os }}-ghcjs8.6-${{ hashFiles('cabal.project.freeze') }}
161150 restore-keys: |
162− ubuntu-18.04-ghcjs8.4-
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
151+ ${{ runner.os }}-ghcjs8.6-
168152
169153 - name: Build
170154 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"
172156
173− - name: Run tests
157+ - name: Tests
174158 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
159+ nix-shell ghcjs.nix --run ".github/run-ghcjs-tests.sh"