Add back whitespace workflow
[cabal.git] / .github / workflows / whitespace.yml
blobcbdf9ca914c530f679d501db9a96402d52dc9abd
1 name: Whitespace
3 on:
4   pull_request:
5   push:
6     branches: ["master"]
8 jobs:
9   whitespace:
10     runs-on: ubuntu-latest
12     env:
13      fix-whitespace-ver: '0.1'
15     steps:
16     - uses: actions/checkout@v4
18     - name: Create directory for binary
19       run: |
20         mkdir -p $HOME/.local/bin
22     - uses: actions/cache@v3
23       name: Cache the binary
24       id: cache
25       with:
26         path: "~/.local/bin"
27         key: fix-whitespace-${{ env.fix-whitespace-ver }}
29     - uses: haskell-actions/setup@v2
30       if: ${{ !steps.cache.outputs.cache-hit }}
31       with:
32         ghc-version: '9.8'
33         cabal-version: latest
35     - name: Install fix-whitespace
36       if: ${{ !steps.cache.outputs.cache-hit }}
37       run: |
38         cabal install --ignore-project --install-method=copy --installdir=$HOME/.local/bin fix-whitespace-${{ env.fix-whitespace-ver }}
39         strip $HOME/.local/bin/fix-whitespace
41     - name: Check Whitespace Conformance
42       run: |
43         $HOME/.local/bin/fix-whitespace --check