forked from MilesCranmer/SymbolicRegression.jl
-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (41 loc) · 1.28 KB
/
check-format.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Taken from https://github.com/julia-actions/julia-format
name: format-check
on:
push:
branches:
- 'master'
- 'release-'
tags: '*'
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.8.2]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- name: "Cache dependencies"
uses: julia-actions/cache@v1
- name: Install JuliaFormatter and format
# This will use the latest version by default but you can set the version like so:
#
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
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. Please run JuliaFormatter.format(\".\") from the repository root."
write(stdout, out)
exit(1)
end'