From d4e772941f90eb2cea088e1882c93fda02fcbe2f Mon Sep 17 00:00:00 2001 From: Michael Schlottke-Lakemper Date: Mon, 29 Jan 2024 16:07:28 +0100 Subject: [PATCH 1/4] Separate format check --- .github/workflows/FormatCheck.yml | 43 +++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 6 ----- 2 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/FormatCheck.yml diff --git a/.github/workflows/FormatCheck.yml b/.github/workflows/FormatCheck.yml new file mode 100644 index 0000000..eb2cfb8 --- /dev/null +++ b/.github/workflows/FormatCheck.yml @@ -0,0 +1,43 @@ +name: format-check + +on: + push: + branches: + - 'main' + tags: '*' + pull_request: + +jobs: + check-format: + runs-on: ${{ matrix.os }} + strategy: + matrix: + julia-version: [1] + os: [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"))' + julia -e 'using JuliaFormatter; format(".")' + - 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' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acc431d..86e4aca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,12 +56,6 @@ jobs: version: ${{ matrix.version }} - run: julia -e 'using InteractiveUtils; versioninfo(verbose=true)' - uses: julia-actions/cache@v1 - - name: Apply JuliaFormatter and check format - if: matrix.os == 'ubuntu-latest' - run: | - julia -e 'using Pkg; Pkg.add("JuliaFormatter")' - julia -e 'using JuliaFormatter; !format(".", verbose=true) && - error("Code not properly formatted")' - name: Build package uses: julia-actions/julia-buildpkg@v1 - name: Run tests From a1dab93dfd89298a854535b1e00bc887e29152cf Mon Sep 17 00:00:00 2001 From: Michael Schlottke-Lakemper Date: Mon, 29 Jan 2024 16:11:18 +0100 Subject: [PATCH 2/4] Also disable CodeCov annotations *blegh* --- .codecov.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..93fc040 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,5 @@ +# xref: https://docs.codecov.io/docs/codecovyml-reference + +# Disable annotations (annoying!) +github_checks: + annotations: false From e9e66eea2a968a23472e4fbf696b25ada0f3b984 Mon Sep 17 00:00:00 2001 From: Michael Schlottke-Lakemper Date: Mon, 29 Jan 2024 16:12:55 +0100 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- .github/workflows/FormatCheck.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/FormatCheck.yml b/.github/workflows/FormatCheck.yml index eb2cfb8..e51a194 100644 --- a/.github/workflows/FormatCheck.yml +++ b/.github/workflows/FormatCheck.yml @@ -18,15 +18,11 @@ jobs: - 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"))' julia -e 'using JuliaFormatter; format(".")' From 44a16f9a797100b26a7769f67b30997fbc15e2c2 Mon Sep 17 00:00:00 2001 From: Michael Schlottke-Lakemper Date: Mon, 29 Jan 2024 16:30:15 +0100 Subject: [PATCH 4/4] Add julia-cache --- .github/workflows/FormatCheck.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/FormatCheck.yml b/.github/workflows/FormatCheck.yml index e51a194..a983404 100644 --- a/.github/workflows/FormatCheck.yml +++ b/.github/workflows/FormatCheck.yml @@ -15,10 +15,14 @@ jobs: julia-version: [1] os: [ubuntu-latest] steps: - - uses: julia-actions/setup-julia@latest + - name: Check out project + uses: actions/checkout@v4 + - name: Set up Julia + uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.julia-version }} - - uses: actions/checkout@v4 + - run: julia -e 'using InteractiveUtils; versioninfo(verbose=true)' + - 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: #