Skip to content

Commit f456c1e

Browse files
Adds formatting workflow (#530)
* adds formatting workflow * adds format check workflow minor tries format-check from Optimization.jl formatting test skip formatting of @docs
1 parent fdfe14b commit f456c1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3384
-3204
lines changed

.JuliaFormatter.toml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
style = "blue"

.github/workflows/CI.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
version:
18-
- "1.6.7" # LTS
18+
- "1.6.7" # LTS
1919
- "1.6"
20-
- "1" # Latest Release
20+
- "1" # Latest Release
2121
os:
2222
- ubuntu-latest
2323
arch:
2424
- x64
2525

2626
steps:
27-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
2828
- uses: julia-actions/setup-julia@latest
2929
with:
3030
version: ${{ matrix.version }}
@@ -53,10 +53,10 @@ jobs:
5353
name: Documentation
5454
runs-on: ubuntu-latest
5555
steps:
56-
- uses: actions/checkout@v2
56+
- uses: actions/checkout@v4
5757
- uses: julia-actions/setup-julia@latest
5858
with:
59-
version: '1'
59+
version: "1"
6060
- run: |
6161
git config --global user.name name
6262
git config --global user.email email

.github/workflows/DocCleanup.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout gh-pages branch
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v4
1313
with:
1414
ref: gh-pages
1515

1616
- name: Delete preview and history
1717
run: |
18-
git config user.name "Documenter.jl"
19-
git config user.email "[email protected]"
20-
git rm -rf "previews/PR$PRNUM"
21-
git commit -m "delete preview"
22-
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
18+
git config user.name "Documenter.jl"
19+
git config user.email "[email protected]"
20+
git rm -rf "previews/PR$PRNUM"
21+
git commit -m "delete preview"
22+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
2323
env:
24-
PRNUM: ${{ github.event.number }}
24+
PRNUM: ${{ github.event.number }}
2525

2626
- name: Push changes
2727
run: |
28-
git push --force origin gh-pages-new:gh-pages
28+
git push --force origin gh-pages-new:gh-pages

.github/workflows/FormatCheck.yml

+42
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@v4
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`) |> 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'

0 commit comments

Comments
 (0)