-
Notifications
You must be signed in to change notification settings - Fork 6
162 lines (136 loc) · 3.84 KB
/
code-style.yml
File metadata and controls
162 lines (136 loc) · 3.84 KB
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Code Style
on:
push:
jobs:
hlint:
runs-on: ubuntu-24.04
env:
HLINT_VERSION: '3.10'
steps:
# (1) -> Init
- name: Checkout git repository
uses: actions/checkout@v6
- name: Prepare ~/.local/bin
run: |
mkdir -p ~/.local/bin
export PATH=~/.local/bin:$PATH
# (2) -> Setup cache
- name: Cache ~/.local/bin
id: cache-local-bin
uses: actions/cache@v5
with:
path: ~/.local/bin
key: local-bin-${{ env.HLINT_VERSION }}
# (3) -> Prepare and install dependencies
- name: Setup hlint
if: steps.cache-local-bin.outputs.cache-hit != 'true'
run: |
curl -L $HLINT_URL | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/hlint'
env:
HLINT_URL: https://github.com/ndmitchell/hlint/releases/download/v${{ env.HLINT_VERSION }}/hlint-${{ env.HLINT_VERSION }}-x86_64-linux.tar.gz
# (4) -> Run hlint
- name: Run hlint
run: |
hlint \
shared-common \
registry-public \
registry-server \
wizard-public \
wizard-server
fourmolu:
runs-on: ubuntu-24.04
env:
FOURMOLU_VERSION: '0.19.0.1'
HPACK_VERSION: '0.38.3'
steps:
# (1) -> Init
- name: Checkout git repository
uses: actions/checkout@v6
- name: Prepare ~/.local/bin
run: |
mkdir -p ~/.local/bin
export PATH=~/.local/bin:$PATH
# (2) -> Setup cache
- name: Cache ~/.local/bin
id: cache-local-bin
uses: actions/cache@v5
with:
path: ~/.local/bin
key: local-bin-${{ env.FOURMOLU_VERSION }}-${{ env.HPACK_VERSION }}
# (3) -> Prepare and install dependencies
- name: Setup hpack && fourmolu
if: steps.cache-local-bin.outputs.cache-hit != 'true'
run: |
curl -L $HPACK_URL --output hpack.gz
gzip -d hpack.gz
chmod +x hpack
cp ./hpack ~/.local/bin/hpack
curl -L $FOURMOLU_URL --output fourmolu
chmod +x fourmolu
cp ./fourmolu ~/.local/bin/fourmolu
env:
HPACK_URL: https://github.com/sol/hpack/releases/download/${{ env.HPACK_VERSION}}/hpack_linux.gz
FOURMOLU_URL: https://github.com/fourmolu/fourmolu/releases/download/v${{ env.FOURMOLU_VERSION }}/fourmolu-${{ env.FOURMOLU_VERSION }}-linux-x86_64
# (4) -> Generate cabal files
- name: Generate cabal files
run: |
cd shared-common
hpack --force
cd ..
cd registry-public
hpack --force
cd ..
cd registry-server
hpack --force
cd ..
cd wizard-public
hpack --force
cd ..
cd wizard-server
hpack --force
cd ..
# (5) -> Run fourmolu
- name: Run fourmolu
run: |
FILES=$(find \
shared-common/src \
registry-public/src \
registry-server/src registry-server/test \
wizard-public/src \
wizard-server/src wizard-server/test \
-name '*.hs'
)
RET=0
for FILE in $FILES; do
if ! fourmolu --quiet --mode check $FILE; then
echo "Unformatted file: " . $FILE
RET=1
fi
done
exit $RET
# CSpell
cspell:
runs-on: ubuntu-24.04
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
- name: Install CSpell
run: |
npm install -g cspell
npm install -g @cspell/dict-python
- name: Run CSpell
run: |
cspell \
--no-progress \
--no-summary \
--config .cspell/cspell.json \
**/*.hs \
**/*.md \
**/*.json \
**/*.toml \
**/*.yml \
**/*.yaml