diff --git a/.github/workflows/FormatCheck.yml b/.github/workflows/FormatCheck.yml index bfd178ee..d062a7a7 100644 --- a/.github/workflows/FormatCheck.yml +++ b/.github/workflows/FormatCheck.yml @@ -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 + '