CI: use GitHub workflow command to set system path

This way, the PATH environment variable does not have to be set
repeatedly in each step.
This commit is contained in:
Albert Krewinkel 2020-06-20 09:00:13 +02:00
parent 112e98def6
commit b907d25fe4
No known key found for this signature in database
GPG key ID: 388DC0B21F631124

View file

@ -68,6 +68,9 @@ jobs:
sudo apt-get update
sudo apt-get install ghc-${{ matrix.versions.ghc }} cabal-install-${{ matrix.versions.cabal }}
fi
# Use a GitHub workflow command to add folders to PATH.
echo "::add-path::/opt/ghc/${{ matrix.versions.ghc }}/bin"
echo "::add-path::/opt/cabal/${{ matrix.versions.cabal }}/bin"
# declare/restore cached things
# caching doesn't work for scheduled runs yet
@ -89,12 +92,10 @@ jobs:
- name: Install dependencies
run: |
export PATH=/opt/cabal/${{ matrix.versions.cabal }}/bin:/opt/ghc/${{ matrix.versions.ghc }}/bin:$PATH
cabal v2-update
cabal v2-build --dependencies-only --enable-tests --disable-optimization
- name: Build and test
run: |
export PATH=/opt/cabal/${{ matrix.versions.cabal }}/bin:/opt/ghc/${{ matrix.versions.ghc }}/bin:$PATH
cabal v2-build --enable-tests --disable-optimization 2>&1 | tee build.log
# fail if warnings in local build
! grep -q ": *[Ww]arning:" build.log || exit 1