Skip to content

Commit 61f37c0

Browse files
committed
Add FormatCheck to CI
1 parent 9c7fa73 commit 61f37c0

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/FormatCheck.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: format-check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
tags: '*'
11+
12+
jobs:
13+
build:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
julia-version: [1]
18+
julia-arch: [x86]
19+
os: [ubuntu-latest]
20+
steps:
21+
- uses: julia-actions/setup-julia@latest
22+
with:
23+
version: ${{ matrix.julia-version }}
24+
25+
- uses: actions/checkout@v1
26+
- name: Install JuliaFormatter and format
27+
# This will use the latest version by default but you can set the version like so:
28+
#
29+
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
30+
run: |
31+
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
32+
julia -e 'using JuliaFormatter; format(".", verbose=true)'
33+
- name: Format check
34+
run: |
35+
julia -e '
36+
out = Cmd(`git diff`) |> read |> String
37+
if out == ""
38+
exit(0)
39+
else
40+
@error "Some files have not been formatted !!!"
41+
write(stdout, out)
42+
exit(1)
43+
end'

0 commit comments

Comments
 (0)