File tree Expand file tree Collapse file tree 3 files changed +49
-1
lines changed Expand file tree Collapse file tree 3 files changed +49
-1
lines changed Original file line number Diff line number Diff line change 56
56
- name : Run tests
57
57
run : |
58
58
cabal test all
59
+
60
+ fourmolu :
61
+ runs-on : ubuntu-latest
62
+
63
+ defaults :
64
+ run :
65
+ shell : bash
66
+
67
+ strategy :
68
+ fail-fast : false
69
+
70
+ steps :
71
+ - uses : actions/checkout@v4
72
+
73
+ - name : Install fourmolu
74
+ run : |
75
+ FOURMOLU_VERSION="0.16.2.0"
76
+ mkdir -p "$HOME/.local/bin"
77
+ curl -sL "https://github.com/fourmolu/fourmolu/releases/download/v${FOURMOLU_VERSION}/fourmolu-${FOURMOLU_VERSION}-linux-x86_64" -o "$HOME/.local/bin/fourmolu"
78
+ chmod a+x "$HOME/.local/bin/fourmolu"
79
+ echo "$HOME/.local/bin" >> $GITHUB_PATH
80
+
81
+ - name : Run fourmolu
82
+ run : ./scripts/fourmolize.sh
83
+
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ let shellFor = fun ghcver =>
8
8
let hspkg = import_hs ghcver in {
9
9
packages = {
10
10
haskell-language-server = hspkg "haskell-language-server" ,
11
- ormolu = hspkg "ormolu " ,
11
+ fourmolu = hspkg "fourmolu " ,
12
12
ghc = organist . import_nix "nixpkgs#haskell.compiler.%{ghcver }" ,
13
13
cabal-install = hspkg "cabal-install" ,
14
14
cabal-fmt = hspkg "cabal-fmt" ,
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ if [[ $# -gt 0 ]]; then
6
+ case " $1 " in
7
+ --changes)
8
+ files=$( git diff --diff-filter=MA --name-only origin/master HEAD -- ' *.hs' )
9
+ if [[ -n " $files " ]]; then
10
+ # Run fourmolu on changes compared to `master`.
11
+ fourmolu -m inplace $( echo " $files " | grep -v Setup.hs)
12
+ fi
13
+ ;;
14
+ * )
15
+ echo " Invalid option: $1 " >&2
16
+ exit 1
17
+ ;;
18
+ esac
19
+ else
20
+ fourmolu -m inplace $( git ls-files -- ' *.hs' | grep -v Setup.hs)
21
+ fi
22
+
23
+ git diff --exit-code
You can’t perform that action at this time.
0 commit comments