Skip to content

Commit

Permalink
Add format suggestions to CI (#2118)
Browse files Browse the repository at this point in the history
* Start

* Update .github/workflows/FormatCheck.yml

Co-authored-by: Hendrik Ranocha <[email protected]>

* Update .github/workflows/FormatCheck.yml

Co-authored-by: Hendrik Ranocha <[email protected]>

* Update .github/workflows/FormatCheck.yml

Co-authored-by: Hendrik Ranocha <[email protected]>

* Fix

* Sample

* Revert

* Revert

---------

Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Huiyu Xie <[email protected]>
Co-authored-by: Michael Schlottke-Lakemper <[email protected]>
  • Loading branch information
4 people authored Oct 22, 2024
1 parent 54237d3 commit 4a81e00
Showing 1 changed file with 6 additions and 33 deletions.
39 changes: 6 additions & 33 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: format-check
name: Format suggestions

on:
push:
Expand All @@ -8,37 +8,10 @@ on:
pull_request:

jobs:
check-format:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x86]
os: [ubuntu-latest]
format-suggestions:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v4
- 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"))'
#
# TODO: Change the call below to
# format(".")
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter", version="1.0.60"))'
julia -e 'using JuliaFormatter; format(["benchmark", "examples", "ext", "src", "test", "utils"])'
- 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'
- uses: julia-actions/julia-format@v3
with:
version: "1.0.60"

0 comments on commit 4a81e00

Please sign in to comment.