-
Notifications
You must be signed in to change notification settings - Fork 17
140 lines (108 loc) · 3.7 KB
/
haskell.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Haskell CI
on:
push:
branches: ["main"]
pull_request:
merge_group:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc: ["8.10", "9.2", "9.4", "9.6", "9.8"]
os: [ubuntu-latest, macos-latest, windows-latest]
defaults:
run:
shell: 'bash'
steps:
- name: Set cache version
run: echo "CACHE_VERSION=pu4Aevoo_v1" >> $GITHUB_ENV
- name: "Setup Haskell"
uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: "3.10.1.0"
- uses: actions/checkout@v3
- name: "Configure cabal.project.local"
run: |
cat ./.github/workflows/cabal.project.local > ./cabal.project.local
cat ./cabal.project.local
- name: "Cabal update"
run: cabal update
- name: Record dependencies
id: record-deps
run: |
cabal build all --dry-run
cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
echo "weeknum=$(/bin/date -u "+%W")" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: "Cache cabal store"
with:
path: ${{ runner.os == 'Windows' && steps.win-setup-haskell.outputs.cabal-store || steps.setup-haskell.outputs.cabal-store }}
key: cache-dependencies-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
restore-keys: cache-dependencies-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}
- uses: actions/cache@v3
name: "Cache `dist-newstyle`"
with:
path: |
dist-newstyle
!dist-newstyle/**/.git
key: cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ steps.record-deps.outputs.weeknum }}
restore-keys: cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}
- name: Build dependencies
run: |
cabal build --only-dependencies all
- name: Build projects [build]
run: cabal build all
- name: Build documentation [haddock]
run: cabal haddock all
- name: io-sim [test]
run: cabal run io-sim:test
- name: si-timers [test]
run: cabal run si-timers:test
- name: strict-mvar [test]
run: cabal run strict-mvar:test
stylish-haskell:
runs-on: ubuntu-22.04
env:
STYLISH_HASKELL_VERSION: "0.14.4.0"
steps:
- name: Set cache version
run: |
echo "CACHE_VERSION=hi5eTh3A" >> $GITHUB_ENV
- name: "Install build environment (apt-get)"
run: |
sudo apt-get update
sudo apt-get -y install fd-find
- name: "Setup Haskell"
uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: 9.6.3
cabal-version: 3.10.1.0
- name: "Setup cabal bin path"
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- uses: actions/cache@v3
name: "Cache cabal store"
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: cache-dependencies-${{ env.CACHE_VERSION }}
- name: Download stylish-haskell
run: |
version="${{ env.STYLISH_HASKELL_VERSION }}"
curl -sL \
"https://github.com/haskell/stylish-haskell/releases/download/v$version/stylish-haskell-v$version-linux-x86_64.tar.gz" \
| tar -C "/tmp" -xz
echo "PATH=/tmp/stylish-haskell-v$version-linux-x86_64:$PATH" >> $GITHUB_ENV
- name: "`stylish-haskell` version"
run: |
which stylish-haskell
stylish-haskell --version
- uses: actions/checkout@v3
- name: "Run `stylish-haskell`"
run: |
./scripts/check-stylish.sh
git diff --exit-code