Fix stack test, add to CI #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: stack test | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
permissions: | |
contents: read | |
env: | |
#-- increment this to force-rebuild the cache of dependency packages | |
MANUAL_CACHE_RESET_TESTDEPS: r0 | |
jobs: | |
stack-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ghc: | |
# - 9.10.1 # LTS absent yet | |
- 9.8.3 | |
- 9.6.6 | |
- 9.4.8 | |
- 9.2.8 | |
- 9.0.2 | |
- 8.10.7 | |
- 8.8.4 | |
- 8.6.5 | |
- 8.4.4 | |
- 8.2.2 | |
- 8.0.2 | |
name: stack test with GHC ${{ matrix.ghc }} | |
steps: | |
- uses: actions/checkout@v4 | |
#-- ghcup, cached | |
- name: Cache GHC installation | |
uses: actions/cache@v4 | |
id: ghcup | |
with: | |
path: | | |
~/.ghcup/bin/* | |
~/.ghcup/cache/* | |
~/.ghcup/config.yaml | |
~/.ghcup/ghc/${{ matrix.ghc }} | |
key: CI-ghcup-${{ matrix.ghc }} | |
- uses: haskell-actions/setup@v2 | |
if: steps.ghcup.outputs.cache-hit != 'true' | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
enable-stack: true | |
stack-version: latest | |
cabal-update: true | |
- name: ghcup diagnostics | |
run: | | |
ghcup list | |
du -csh ~/.ghcup/* | |
ls -ld ~/.ghcup/*/* | |
#-- stack pantry, cached | |
- name: Cache Pantry (Stackage package index) | |
id: pantry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.stack/pantry | |
key: CI-pantry-${{ env.STACK_LTS }} | |
- name: Recompute Stackage package index | |
if: steps.pantry.outputs.cache-hit != 'true' | |
run: stack update # populates ~/.stack/pantry | |
- name: ~/.stack cache diagnostics | |
run: du -csh -t 64k ~/.stack/* | |
- name: Configure Stack | |
run: | | |
stack config set system-ghc true --global | |
stack config set install-ghc false --global | |
#-- for the matrix, we'll need a map GHC version -> Stack LTS resolver | |
- name: Cached LTS-GHC map | |
id: ltsmap | |
uses: actions/cache@v4 | |
with: | |
path: lts-resolver-map.yaml | |
key: lts-resolver-map | |
- name: Regenerate LTS-GHC map | |
if: steps.ltsmap.outputs.cache-hit != 'true' | |
run: | | |
timeout 300 .github/scripts/stackage-lts-map.hs \ | |
| sort -n | tee lts-resolver-map.yaml | |
selected="$(yq '.["${{ matrix.ghc }}"]' lts-resolver-map.yaml)" | |
test -z $selected -o $selected == null && { | |
echo "Could not find LTS snapshot for GHC version ${{ matrix.ghc }}" | |
echo "Version map:"; cat lts-resolver-map.yaml | |
exit 1 | |
} >&2 | |
stack config set resolver $selected | |
#-- not much deps in this package; however Cabal is a large one. cache, too | |
- name: Cache Haskell dependencies | |
uses: actions/cache@v4 | |
env: | |
MANUAL_RESET: ${{ env.MANUAL_CACHE_RESET_TESTDEPS }} | |
with: | |
path: | | |
~/.stack/stack.sqlite3 | |
~/.stack/snapshots | |
key: CI-testdeps-${{ env.MANUAL_RESET }}-lock${{ hashFiles('**/stack.yaml.lock') }} | |
- name: ~/.stack cache diagnostics | |
run: du -csh -t 64k ~/.stack/* | |
#-- compiling time! | |
- name: Build dependencies | |
run: stack build --test --only-dependencies | |
- name: Compile project & examples | |
run: stack build --test --no-run-tests | |
- name: Run tests | |
run: stack test |