-
Notifications
You must be signed in to change notification settings - Fork 7
101 lines (80 loc) · 2.67 KB
/
main-pull.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: CI Pull Request
on:
pull_request:
branches: [main]
permissions:
contents: write
jobs:
on-main-pull-request:
strategy:
matrix:
os: [ubuntu-latest]
cabal: [3.10.3.0]
ghc: [9.6.6]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Set up Haskell
uses: haskell-actions/[email protected]
id: setup
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
cabal-update: true
- name: Configure Cabal
run: |
cabal update
cabal configure --enable-tests --enable-benchmarks --enable-documentation
- name: Generate cache key
# Creates plan.json file
run: |
cabal build all --dry-run
- name: Restore cached dependencies
uses: actions/cache/[email protected]
id: cache
env:
key: ${{ matrix.os }}-ghc-${{ matrix.ghc }}-cabal-${{ matrix.cabal }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-
- name: Install stylish-haskell
run: |
cabal install stylish-haskell
- name: Lint Haskell
run: |
find . -name '*.hs' -exec sh -c 'for file do stylish-haskell --inplace "$file"; done' sh {} +
- name: Auto-commit lint
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: stylish-haskell auto-commit
commit_user_name: GitHub Action
commit_user_email: [email protected]
branch: ${{ github.head_ref }}
- name: Install dependencies
# If we had an exact cache hit, the dependencies will be up to date.
if: steps.cache.outputs.cache-hit != 'true'
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/[email protected]
# If we had an exact cache hit, trying to save the cache would error because of key clash.
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Build
run: |
cabal build all -f Pedantic
- name: Test
run: cabal test all --test-option="--skip=SLOW"
- name: Compiler benchmark
run: cabal bench compiler-golden-stats
# - name: Check cabal file
# run: cabal check
# - name: Document package
# run: cabal haddock all
# - name: Prepare package for publishing
# run: cabal sdist all