ci: use makefile for fmt

This commit is contained in:
David Hewitt 2021-12-09 08:17:08 +00:00
parent a5ef9ff64a
commit cbe2b2a361
2 changed files with 11 additions and 6 deletions

View File

@ -15,16 +15,16 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install black==20.8b1
- run: pip install black==21.12b0
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt
- name: Check python formatting (black)
run: black --check .
run: make fmt_py
- name: Check rust formatting (rustfmt)
run: cargo fmt --all -- --check
run: make fmt_rust
clippy:
runs-on: ubuntu-latest

View File

@ -1,4 +1,4 @@
.PHONY: test test_py publish clippy lint fmt
.PHONY: test test_py publish clippy lint fmt fmt_py fmt_rust
ALL_ADDITIVE_FEATURES = macros multiple-pymethods num-bigint num-complex hashbrown serde indexmap eyre anyhow
@ -14,10 +14,15 @@ test: lint test_py
test_py:
for example in examples/*/; do TOX_TESTENV_PASSENV=RUSTUP_HOME tox -e py -c $$example || exit 1; done
fmt:
cargo fmt --all -- --check
fmt_py:
black . --check
fmt_rust:
cargo fmt --all -- --check
fmt: fmt_rust fmt_py
@true
clippy:
cargo clippy --features="$(ALL_ADDITIVE_FEATURES)" --all-targets --workspace -- -Dwarnings
cargo clippy --features="abi3 $(ALL_ADDITIVE_FEATURES)" --all-targets --workspace -- -Dwarnings