Skip to content

Commit

Permalink
add formatter action
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Jul 6, 2022
1 parent ccdb3e9 commit d4441a1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
annotate_untyped_fields_with_any = false
short_to_long_function_def = false
whitespace_ops_in_indices = true
remove_extra_newlines = true
whitespace_in_kwargs = true
always_use_return = false
conditional_to_if = false
align_struct_field = true
align_conditional = true
align_assignment = true
align_pair_arrow = true
import_to_using = false
39 changes: 39 additions & 0 deletions .github/workflows/Format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: format

on:
push:
branches:
- 'master'
- 'release-'
tags: '*'
pull_request:

jobs:
check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1']
julia-arch: [x64]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v2
- name: Install JuliaFormatter and format
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
julia -e 'using JuliaFormatter; format(["src", "test"], verbose=true)'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'

0 comments on commit d4441a1

Please sign in to comment.