Skip to content

Commit 720be40

Browse files
committed
Prefer just fmt and paths-filter over julia-formatter action
1 parent d4c8c74 commit 720be40

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

.github/workflows/CI.yml

+26-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
name: CI
22
# Run on master, tags, or any pull request
33
on:
4-
schedule:
5-
- cron: '0 2 * * *' # Daily at 2 AM UTC (8 PM CST)
64
push:
7-
branches: [master]
8-
tags: ["*"]
5+
branches:
6+
- master
7+
tags: ['*']
98
pull_request:
10-
9+
workflow_dispatch:
10+
concurrency:
11+
# Skip intermediate builds: always.
12+
# Cancel intermediate builds: only if it is a pull request build.
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
1115
jobs:
1216
test:
1317
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
@@ -69,7 +73,23 @@ jobs:
6973
steps:
7074
- uses: actions/checkout@v4
7175
- uses: julia-actions/setup-julia@latest
72-
- uses: julia-actions/julia-format@v3
76+
- uses: extractions/setup-just@v1 # or taiki-e/install-action@just
77+
78+
# Adapted from:
79+
# github.com/FluxML/Flux.jl/blob/7be1ca7a/.github/workflows/JuliaFormatter.yml
80+
- uses: dorny/paths-filter@v3
81+
id: filter
82+
with:
83+
filters: |
84+
julia_file_change:
85+
- added|modified: '**/*.jl'
86+
- name: Apply JuliaFormatter
87+
run: |
88+
just fmt
89+
- name: Check formatting diff
90+
if: steps.filter.outputs.julia_file_change == 'true'
91+
run: |
92+
git diff --color=always --exit-code
7393
7494
perf:
7595
name: Performance

justfile

+6-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bench: (instantiate-dev bench_dir)
4444

4545
# Check formatting with blue style
4646
[group: 'ci']
47-
fmt:
47+
fmt: install-package JuliaFormatter
4848
# https://github.com/invenia/BlueStyle
4949
julia --project=@JuliaFormatter -e 'using JuliaFormatter; format("{{project_dir}}", style=BlueStyle())'
5050

@@ -56,3 +56,8 @@ instantiate:
5656
[private]
5757
instantiate-dev dev_project_dir:
5858
julia --project={{dev_project_dir}} -e '{{dev_instantiate_code}}'
59+
60+
# Install a package to a (temporary) package-specific project
61+
[private]
62+
install-package package:
63+
julia --project=@{{package}} -e 'import Pkg; Pkg.add("{{package}}")'

0 commit comments

Comments
 (0)