Skip to content

Commit bb3942e

Browse files
authored
Merge pull request #1601 from SciML/myb/ci
Formatter CI
2 parents 4f999b1 + 97a7b70 commit bb3942e

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

.github/workflows/FormatCheck.yml

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

test/input_output_handling.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@ fsys2 = flatten(sys2)
3636
@test !is_bound(fsys2, sys.u)
3737
@test !is_bound(fsys2, sys2.sys.u)
3838

39-
4039
@test is_bound(sys3, sys.u) # I would like to write sys3.sys.u here but that's not how the variable is stored in the equations
4140
@test is_bound(sys3, sys.x)
4241

4342
@test is_bound(sys4, sys.u)
4443
@test !is_bound(sys4, u)
4544

4645
fsys4 = flatten(sys4)
47-
@test is_bound(fsys4, sys.u)
46+
@test is_bound(fsys4, sys.u)
4847
@test !is_bound(fsys4, u)
4948

5049
@test isequal(inputs(sys), [u])
@@ -175,7 +174,7 @@ u = [rand()]
175174
@test f[1](x, u, p, 1) == [u; 0; 0; 0]
176175

177176
@parameters t
178-
@variables x(t) u(t) [input=true]
177+
@variables x(t) u(t) [input = true]
179178
eqs = [Differential(t)(x) ~ u]
180179
@named sys = ODESystem(eqs, t)
181180
structural_simplify(sys)

0 commit comments

Comments
 (0)