Skip to content

Commit

Permalink
Define "format-check" workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Nov 1, 2023
1 parent 1a9ce14 commit 4c89142
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: format-check

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

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
version:
- '1.9'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Install JuliaFormatter.jl
run: julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
- name: Format code
run: julia -e 'using JuliaFormatter; format(".", 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 4c89142

Please sign in to comment.