CI: update actions/cache to v3
[cabal.git] / .github / workflows / whitespace.yml
blob1254f7ccc4e643fda0dbcc968de78e1c3f478889
1 name: Assorted
3 on:
4   push:
5     branches:
6       - master
7   pull_request:
8   release:
9     types:
10       - created
11 jobs:
12   check:
13     name: Whitespace
14     runs-on: ubuntu-latest
16     env:
17      fix-whitespace-ver: '0.0.10'
19     steps:
20     - uses: actions/checkout@v3
21       name: Checkout sources
23     - name: Create directory for binary
24       run: |
25         mkdir -p $HOME/.local/bin
27     - uses: actions/cache@v3
28       name: Cache the binary
29       id: cache
30       with:
31         path: "~/.local/bin"
32         key: fix-whitespace-${{ env.fix-whitespace-ver }}
34     # See https://github.com/haskell/cabal/pull/8739
35     - name: Sudo chmod to permit ghcup to update its cache
36       run: |
37         if [[ "${{ runner.os }}" == "Linux" ]]; then
38           sudo mkdir -p /usr/local/.ghcup/cache
39           sudo chown -R $USER /usr/local/.ghcup
40           sudo chmod -R 777 /usr/local/.ghcup
41         fi
43     - uses: haskell/actions/setup@v2
44       if: ${{ !steps.cache.outputs.cache-hit }}
45       with:
46         ghc-version: '9.2'
47         cabal-version: latest
49     - name: Install fix-whitespace
50       if: ${{ !steps.cache.outputs.cache-hit }}
51       run: |
52         cabal install --ignore-project --install-method=copy --installdir=$HOME/.local/bin fix-whitespace-${{ env.fix-whitespace-ver }}
53         strip $HOME/.local/bin/fix-whitespace
55     - name: Check the whitespace issue
56       run: |
57         $HOME/.local/bin/fix-whitespace --check