Skip to content

Handle the line prefix correctly #318

Handle the line prefix correctly

Handle the line prefix correctly #318

name: Haskell Cabal
on:
push:
branches: [master]
pull_request:
branches: [master]
types: [opened, synchronize]
permissions: {}
jobs:
test:
name: CI
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # don't cancel other jobs if one fails
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
ghc: ["8.10.7", "9.0.2", "9.2.7", "9.4.5", "9.6.1"]
defaults:
run:
# The default shell on Windows is `pwsh`. However, it doesn't expand
# asterisks. That's why we always use `bash`.
shell: bash
steps:
# Without this, self-validation will fail on Windows because HIndent converts
# newlines to LF while the cloned source code contains CRLF.
- name: Modify the git setting not to convert LF to CRLF
run: git config --global core.autocrlf input
- name: "Checkout code"
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
persist-credentials: false
- name: Setup Haskell Compiler (cabal)
id: setup-haskell
uses: haskell/actions/setup@921b0b6e6b2a8da7388666e544cfa934157eedc7 # v2.4.1
with:
ghc-version: ${{ matrix.ghc }}
- name: Cache dist-newstyle
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: dist-newstyle
key: dist-newstyle-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('internal/**','src/**','app/**','tests/**','benchmarks/**') }}
restore-keys: |
dist-newstyle-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }}-
dist-newstyle-${{ matrix.os }}-${{ matrix.ghc }}-
- name: Cache ~/.cabal/store
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: cabal-store-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }}
restore-keys: cabal-store-${{ matrix.os }}-${{ matrix.ghc }}-
- name: Configure to run tests and benchmarks
run: cabal configure --enable-tests --enable-benchmarks
- name: Build code
run: cabal build
- name: Test code
run: cabal test
- name: Benchmark code
run: cabal bench
- name: Generate documentation
run: cabal haddock all
# TODO(mihaimaruseac): Move to using a custom action that can be reused
- name: Validate code formatting (self-validate)
run: cabal run hindent -- **/*.hs --validate