Skip to content

Commit 9691f1c

Browse files
committed
Fix #8316: run fix-whitespace --check as CI workflow
1 parent b80cc0a commit 9691f1c

File tree

2 files changed

+189
-0
lines changed

2 files changed

+189
-0
lines changed

.github/workflows/whitespace.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Whitespace
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
release:
9+
types:
10+
- created
11+
jobs:
12+
check:
13+
runs-on: ubuntu-20.04
14+
15+
strategy:
16+
matrix:
17+
ghc-ver: ['9.2']
18+
cabal-ver: [latest]
19+
# stack-ver: [2.5.1]
20+
fix-whitespace-ver: [0.0.7]
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
name: Checkout sources
25+
26+
- name: Create directory for binary
27+
run: |
28+
mkdir -p $HOME/.local/bin
29+
30+
- uses: actions/cache@v2
31+
name: Cache the binary
32+
id: cache
33+
with:
34+
path: "~/.local/bin"
35+
key: fix-whitespace-${{ matrix.fix-whitespace-ver }}
36+
37+
- uses: haskell/actions/setup@v1
38+
if: ${{ !steps.cache.outputs.cache-hit }}
39+
with:
40+
ghc-version: ${{ matrix.ghc-ver }}
41+
cabal-version: ${{ matrix.cabal-ver }}
42+
# stack-version: ${{ matrix.stack-ver }}
43+
# enable-stack: true
44+
45+
- name: Install fix-whitespace
46+
if: ${{ !steps.cache.outputs.cache-hit }}
47+
run: |
48+
cabal install --install-method=copy --installdir=$HOME/.local/bin fix-whitespace
49+
strip $HOME/.local/bin/fix-whitespace
50+
51+
- name: Check the whitespace issue
52+
run: |
53+
$HOME/.local/bin/fix-whitespace --check

fix-whitespace.yaml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# This file contains the project-specific settings for `fix-whitespace` a tiny
2+
# but useful tool to
3+
#
4+
# * Removes trailing whitespace.
5+
# * Removes trailing lines containing nothing but whitespace.
6+
# * Ensures that the file ends in a newline character.
7+
#
8+
# By default, fix-whitespace checks every directory under the current working
9+
# directory but no files. This program should be placed under a text-based
10+
# project.
11+
#
12+
# For directories,
13+
#
14+
# 1) excluded-dirs is a black-list of directories,
15+
# 2) included-dirs is a white-list of excluded-dirs
16+
#
17+
# For files,
18+
#
19+
# 3) included-files is a white-list of files,
20+
# 4) excluded-files is a black-list of included-files.
21+
#
22+
# The extended glob pattern can be used to specify file/direcotory names.
23+
# For details, see http://hackage.haskell.org/package/filemanip-0.3.6.3/docs/System-FilePath-GlobPattern.html
24+
#
25+
included-dirs:
26+
# Without this line the above path will be excluded.
27+
28+
excluded-dirs:
29+
- "**/dist*" # matches every dist* in any directory
30+
- _darcs
31+
- .git
32+
- .python-sphinx-virtualenv
33+
- .stack-work
34+
- .vscode
35+
36+
# Every matched filename is included unless it is matched by excluded-files.
37+
included-files:
38+
- .dockerignore
39+
- .gitignore
40+
- .gitattributes
41+
- AUTHORS
42+
- LICENSE
43+
- "cabal.project.*"
44+
- "*.ac"
45+
- "*.bat"
46+
- "*.bat_t"
47+
- "*.c"
48+
- "*.cabal"
49+
- "*.cmm"
50+
- "*.cobol"
51+
- "*.conf"
52+
- "*.config"
53+
- "*.cfg"
54+
- "*.cpp"
55+
- "*.csh"
56+
- "*.css"
57+
- "*.css_t"
58+
- "*.dhall"
59+
- "*.dockerfile"
60+
- "*.el"
61+
- "*.h"
62+
- "*.hs"
63+
- "*.hs-boot"
64+
- "*.hsc"
65+
- "*.hsig"
66+
- "*.html"
67+
- "*.html_t"
68+
- "*.in"
69+
- "*.inc"
70+
- "*.js"
71+
- "*.js_t"
72+
- "*.json"
73+
- "*.lhs"
74+
- "*.md"
75+
- "*.py"
76+
- "*.rst"
77+
- "*.rst_t"
78+
- "*.sh"
79+
- "*.sty"
80+
- "*.tex"
81+
- "*.tex_t"
82+
- "*.toml"
83+
- "*.txt"
84+
- "*.x"
85+
- "*.y"
86+
- "*.yaml"
87+
- "*.yml"
88+
- "*.zinza"
89+
90+
excluded-files:
91+
# Exceptions
92+
- Cabal-syntax/src/Distribution/Fields/Lexer.hs
93+
- Cabal-tests/tests/ParserTests/warnings/tab.cabal
94+
- Cabal-tests/tests/ParserTests/warnings/utf8.cabal
95+
96+
# These also contain tabs that affect the golden value:
97+
# Could be removed from exceptions, but then the tab warning
98+
# has to be removed from the corresponding .format file.
99+
- Cabal-tests/tests/ParserTests/regressions/monad-param.cabal
100+
- Cabal-tests/tests/ParserTests/regressions/th-lift-instances.cabal
101+
102+
# Files that use tabs
103+
- Makefile
104+
- GNUmakefile
105+
- "*.mk"
106+
- .mailmap
107+
108+
# Generated files
109+
- TAGS
110+
- "*.buildinfo"
111+
- "*.check"
112+
- "*.expr"
113+
- "*.errors"
114+
- "*.format"
115+
- "*.freeze"
116+
- "*.golden"
117+
- "*.log"
118+
- "*.out"
119+
120+
# Binary files
121+
- "*.a"
122+
- "*.dylib"
123+
- "*.dyn_hi"
124+
- "*.dyn_hi-boot"
125+
- "*.enc"
126+
- "*.exe"
127+
- "*.gif"
128+
- "*.gz"
129+
- "*.hi"
130+
- "*.hi-boot"
131+
- "*.o"
132+
- "*.o-boot"
133+
- "*.p_hi"
134+
- "*.p_o"
135+
- "*.png"
136+
- "*.so"

0 commit comments

Comments
 (0)