Skip to content

Run cabal actions on pushes to main. #1

Run cabal actions on pushes to main.

Run cabal actions on pushes to main. #1

Workflow file for this run

name: Run cabal
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
poetry:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
ghc-version:
- "latest"
- "9.6"
- "9.4"
- "9.2"
- "9.0"
- "8.10"
experimental: [false]
include:
- ghc-version: latest
experimental: true
steps:
- uses: actions/checkout@v3
- name: GHC ${{ matrix.ghc-version }}
uses: haskell/actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc-version }}
- name: cabal configure
run: |
cabal configure --enable-tests --enable-benchmarks --disable-documentation
cabal build --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.
- name: Restore cached dependencies
uses: actions/cache/restore@v3
id: cache
env:
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-
- name: dependencies
run: cabal build all --only-dependencies
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
- name: save cached dependencies
uses: actions/cache/save@v3
# Caches are immutable, trying to save with the same key would error.
if: ${{ steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: cabal build
run: cabal build all
- name: cabal test
run: cabal test all
- name: cabal check
run: cabal check
- name: cabal haddock
run: cabal haddock all