-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6fc8f84
commit 61f0613
Showing
1 changed file
with
34 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,44 @@ | ||
name: Format Check | ||
name: format-check | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "release-" | ||
tags: "*" | ||
pull_request: | ||
- "master" | ||
- "release-*" # Match release branches | ||
tags: "*" # Trigger on tag pushes | ||
pull_request: # Trigger on pull requests | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
julia-version: [1] # Julia versions | ||
julia-arch: [x86] # Architectures | ||
os: [ubuntu-latest] # OS | ||
steps: | ||
- uses: julia-actions/setup-julia@latest | ||
# Step 1: Set up Julia | ||
- name: Set up Julia | ||
uses: julia-actions/setup-julia@latest | ||
with: | ||
version: 1 | ||
- uses: actions/checkout@v4 | ||
- name: Install JuliaFormatter | ||
run: | | ||
using Pkg | ||
Pkg.add("JuliaFormatter") | ||
shell: julia --color=yes {0} | ||
- name: Format code | ||
version: ${{ matrix.julia-version }} | ||
arch: ${{ matrix.julia-arch }} | ||
|
||
# Step 2: Check out code | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# Step 3: Install JuliaFormatter and check formatting | ||
- name: Install JuliaFormatter and check formatting | ||
run: | | ||
using JuliaFormatter | ||
format("."; verbose=true) | ||
shell: julia --color=yes {0} | ||
- name: Suggest formatting changes | ||
uses: reviewdog/action-suggester@v1 | ||
if: github.event_name == 'pull_request' | ||
with: | ||
tool_name: JuliaFormatter | ||
fail_on_error: true | ||
julia -e ' | ||
using Pkg; | ||
Pkg.add(PackageSpec(name="JuliaFormatter")); | ||
using JuliaFormatter; | ||
result = format(".", verbose=true) | ||
if !result | ||
error("Some files are not properly formatted. Please run `using JuliaFormatter; format(\".\")` locally.") | ||
else | ||
println("All files are properly formatted.") | ||
end | ||
' |