test: fix Aqua workflow (#59) #237
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Julia Formatter | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "**.jl" | |
- ".JuliaFormatter.toml" | |
pull_request: | |
env: | |
CI: true | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: julia-actions/setup-julia@latest | |
with: | |
version: "1" | |
- uses: actions/checkout@v1 | |
- name: Install JuliaFormatter | |
shell: julia --color=yes {0} | |
run: | | |
using Pkg | |
Pkg.activate("juliaformatter"; shared=true) | |
Pkg.add(PackageSpec(name="JuliaFormatter")) | |
- name: Format files | |
shell: julia --color=yes --project=@juliaformatter {0} | |
run: using JuliaFormatter; format(".", verbose=true) | |
- name: Check for formatting errors | |
shell: julia --color=yes --project=@juliaformatter {0} | |
run: | | |
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 |