-
Notifications
You must be signed in to change notification settings - Fork 3
35 lines (33 loc) · 1.35 KB
/
format.yml
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
name: Black
on: [push]
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install isort>=5.10 black>=22.1
- name: Format
# Both isort and black have a --check option, but to get the imports sorted and formatted correctly,
# I need to run isort _and then_ black, _and then_ check for differences.
run: |
find generative/ tests/ tools/ -name '*.py' -and -not -path '*geom2graph*' -exec isort {} +
find generative/ tests/ tools/ -name '*.py' -and -not -path '*geom2graph*' -exec black --line-length 100 {} +
git diff --exit-code
rust-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Run rustfmt
run: cargo fmt -- --check --config group_imports=StdExternalCrate,imports_granularity=Module