File tree Expand file tree Collapse file tree 9 files changed +88
-105
lines changed
Expand file tree Collapse file tree 9 files changed +88
-105
lines changed Original file line number Diff line number Diff line change @@ -169,11 +169,6 @@ jobs:
169169 - name : Checkout repository
170170 uses : actions/checkout@v4
171171
172- - name : Install system dependencies (apt-get)
173- run : |
174- sudo apt-get update || true
175- sudo apt-get -y install fd-find
176-
177172 - name : Setup Haskell
178173 id : setup-haskell
179174 uses : haskell-actions/setup@v2
@@ -210,7 +205,7 @@ jobs:
210205
211206 - name : Run stylish-haskell
212207 run : |
213- ./scripts/format-stylish-fd .sh
208+ ./scripts/format-stylish.sh
214209 git diff --exit-code
215210
216211 # Check formatting for cabal files
@@ -233,11 +228,6 @@ jobs:
233228 - name : Checkout repository
234229 uses : actions/checkout@v4
235230
236- - name : Install system dependencies (apt-get)
237- run : |
238- sudo apt-get update || true
239- sudo apt-get -y install fd-find
240-
241231 - name : Setup Haskell
242232 id : setup-haskell
243233 uses : haskell-actions/setup@v2
@@ -274,7 +264,7 @@ jobs:
274264
275265 - name : Run cabal-fmt
276266 run : |
277- ./scripts/format-cabal-fd .sh
267+ ./scripts/format-cabal.sh
278268 git diff --exit-code
279269
280270 # Check cabal files
Original file line number Diff line number Diff line change 1- #! /usr/ bin/env bash
1+ #! /bin/sh
22
3- set -euo pipefail
3+ # Check for cabal
4+ cabal=" $( which cabal) "
5+ if [ " ${cabal} " = " " ]; then
6+ echo " Requires cabal; no version found"
7+ exit 1
8+ fi
49
5- for x in $( find . -name ' *.cabal' | grep -v dist-newstyle | cut -c 3-) ; do
6- (
7- d=$( dirname $x )
8- if [ $( basename $d ) != " bloomfilter" ]; then
9- echo " == $d =="
10- cd $d
11- cabal check
12- fi
13- )
14- done
10+ # Check Cabal files with cabal
11+ echo " Checking Cabal source files with cabal"
12+ # shellcheck disable=SC2016
13+ if ! git ls-files --exclude-standard --no-deleted --deduplicate ' *.cabal' | xargs -L 1 sh -c ' echo "$0" && cd "$(dirname "$0")" && cabal check' ; then
14+ exit 1
15+ fi
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ export LC_ALL=C.UTF-8
4+
5+ # Check for cabal-fmt
6+ cabal_fmt_required_version=" 0.1.12"
7+ cabal_fmt=" $( which cabal-fmt) "
8+ if [ " ${cabal_fmt} " = " " ]; then
9+ echo " Requires cabal-fmt version ${cabal_fmt_required_version} ; no version found"
10+ exit 1
11+ fi
12+ cabal_fmt_installed_version=" $( $cabal_fmt --version | head -n 1 | cut -d' ' -f2) "
13+ if [ ! " ${cabal_fmt_installed_version} " = " ${cabal_fmt_required_version} " ]; then
14+ echo " Requires cabal-fmt version ${cabal_fmt_required_version} ; found version ${cabal_fmt_installed_version} "
15+ exit 1
16+ fi
17+
18+ # Check Cabal files with cabal-fmt
19+ echo " Formatting Cabal source files with cabal-fmt version ${cabal_fmt_required_version} "
20+ # shellcheck disable=SC2016
21+ if ! git ls-files --exclude-standard --no-deleted --deduplicate ' *.cabal' | xargs -L 1 sh -c ' echo "$0" && cabal-fmt -i "$0"' ; then
22+ exit 1
23+ fi
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ export LC_ALL=C.UTF-8
4+
5+ # Check for stylish-haskell
6+ stylish_haskell_required_version=" 0.14.6.0"
7+ stylish_haskell=" $( which stylish-haskell) "
8+ if [ " ${stylish_haskell} " = " " ]; then
9+ echo " Requires stylish-haskell version ${stylish_haskell_required_version} ; no version found"
10+ exit 1
11+ fi
12+ stylish_haskell_installed_version=" $( $stylish_haskell --version | head -n 1 | cut -d' ' -f2) "
13+ if [ ! " ${stylish_haskell_installed_version} " = " ${stylish_haskell_required_version} " ]; then
14+ echo " Requires stylish-haskell version ${stylish_haskell_required_version} ; found version ${stylish_haskell_installed_version} "
15+ exit 1
16+ fi
17+
18+ # Check Haskell files with stylish-haskell
19+ echo " Formatting Haskell source files with stylish-haskell version ${stylish_haskell_required_version} "
20+ # shellcheck disable=SC2016
21+ if ! git ls-files --exclude-standard --no-deleted --deduplicate ' *.hs' | xargs -L 1 sh -c ' echo "$0" && stylish-haskell -i -c .stylish-haskell.yaml "$0"' ; then
22+ exit 1
23+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # To install as a Git pre-commit hook, run:
4+ #
5+ # > ln scripts/pre-commit.sh .git/hooks/pre-commit.sh
6+ #
7+
8+ # Check for unstaged changes in Haskell files
9+ unstaged_haskell_files=" $( git ls-files --exclude-standard --no-deleted --deduplicate --modified ' *.hs' ) "
10+ if [ ! " ${unstaged_haskell_files} " = " " ]; then
11+ echo " Found unstaged Haskell files"
12+ echo " ${unstaged_haskell_files} "
13+ exit 1
14+ fi
15+
16+ # Check for unstaged changes in Cabal files
17+ unstaged_cabal_files=" $( git ls-files --exclude-standard --no-deleted --deduplicate --modified ' *.cabal' ) "
18+ if [ ! " ${unstaged_cabal_files} " = " " ]; then
19+ echo " Found unstaged Cabal files"
20+ echo " ${unstaged_cabal_files} "
21+ exit 1
22+ fi
23+
24+ # Run various checks and formatters
25+ ./scripts/check-cabal.sh
26+ ./scripts/format-cabal.sh
27+ ./scripts/format-stylish.sh
You can’t perform that action at this time.
0 commit comments