-
Notifications
You must be signed in to change notification settings - Fork 7
65 lines (56 loc) · 2.18 KB
/
Copy pathformat.yaml
File metadata and controls
65 lines (56 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Format and Hygiene
# Runs the repository's pre-commit suite (JuliaFormatter + file hygiene) so that
# contributors who have not run `pre-commit install` locally are still caught.
#
# DISABLED as a pull request gate for now: the repository has pre-existing
# formatting drift that has to be cleaned up first. Until then, run this
# manually from the Actions tab ("Run workflow") to see the current damage.
#
# To enable it as a gate, uncomment the `pull_request` trigger below. If the
# test suite's `Tests` job is a required status check, add `pre-commit` too.
on:
workflow_dispatch:
# pull_request:
# branches:
# - main
# - develop
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
name: pre-commit
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
with:
# Matches default_language_version in .pre-commit-config.yaml
python-version: '3.10'
- name: Set up Julia
uses: julia-actions/setup-julia@v2
with:
version: '1.11'
# The julia-formatter hook is `language: system`: it shells out to
# `julia -e 'import JuliaFormatter: format; format(ARGS)'` and therefore
# uses whatever JuliaFormatter lives in the default depot environment.
# Pin it to the same version .pre-commit-config.yaml pins the hook repo
# to, otherwise CI and local pre-commit runs disagree on formatting.
- name: Install JuliaFormatter
run: julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="1.0.62"))'
- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-py3.10-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-${{ runner.os }}-py3.10-
- name: Run pre-commit
run: |
python -m pip install --upgrade pre-commit
pre-commit run --all-files --show-diff-on-failure --color=always