Skip to content

refactor: add hspec, nix, and switch to cabal #72

refactor: add hspec, nix, and switch to cabal

refactor: add hspec, nix, and switch to cabal #72

Workflow file for this run

name: Haskell CI
on:
push:
branches:
- "*"
pull_request:
branches: ["master"]
permissions:
contents: read
jobs:
fourmolu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: haskell-actions/run-fourmolu@3b7702b41516aa428dfe6e295dc73476ae58f69e # v11
with:
version: "0.14.0.0"
build:
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
ghc-version: ["9.12", "9.10", "9.8", "9.6", "9.4", "9.2"]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up GHC ${{ matrix.ghc-version }}
uses: haskell-actions/setup@96f3dafd067155f32643c2a0757ab71d2910e2c2 # v2.8.0
id: setup
with:
ghc-version: ${{ matrix.ghc-version }}
- name: Installed minor versions of GHC, Cabal, and Stack
shell: bash
run: |
GHC_VERSION=$(ghc --numeric-version)
CABAL_VERSION=$(cabal --numeric-version)
echo "GHC_VERSION=${GHC_VERSION}" >> "${GITHUB_ENV}"
echo "CABAL_VERSION=${CABAL_VERSION}" >> "${GITHUB_ENV}"
- name: Check cabal file
run: cabal check
- name: Configure the build
run: |
cabal configure --enable-tests --enable-benchmarks --disable-documentation
cabal build --dry-run
- name: Restore cached dependencies
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
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: Build dependencies
run: cabal build --only-dependencies
- name: Save cached dependencies
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Build the package
run: cabal build all
- name: Run tests
run: cabal test all
- name: Build documentation
run: cabal haddock all --disable-documentation