@@ -17,28 +17,42 @@ build:
17
17
cd tket-py && uv run maturin build --release
18
18
19
19
# Run all the tests.
20
- test language = " [rust|python]" : (_run_lang language \
21
- " uv run cargo test --all-features" \
22
- " uv run maturin develop --uv && uv run pytest"
23
- )
20
+ test : test-rust test-python
21
+ # Run all rust tests.
22
+ test-rust * TEST_ARGS :
23
+ uv run cargo test --all-features {{ TEST_ARGS}}
24
+ # Run all python tests.
25
+ test-python * TEST_ARGS :
26
+ uv run maturin develop --uv
27
+ uv run pytest {{ TEST_ARGS}}
24
28
25
29
# Auto-fix all clippy warnings.
26
- fix language = " [rust|python]": (_run_lang language \
27
- " uv run cargo clippy --all-targets --all-features --workspace --fix --allow-staged --allow-dirty" \
28
- " uv run ruff check --fix"
29
- )
30
+ fix : fix-rust fix-python
31
+ # Auto-fix all rust clippy warnings.
32
+ fix-rust :
33
+ uv run cargo clippy --all-targets --all-features --workspace --fix --allow-staged --allow-dirty
34
+ # Auto-fix all python clippy warnings.
35
+ fix-python :
36
+ uv run ruff check --fix
30
37
31
38
# Format the code.
32
- format language = " [rust|python]": (_run_lang language \
33
- " uv run cargo fmt" \
34
- " uv run ruff format"
35
- )
39
+ format : format-rust format-python
40
+ # Format the rust code.
41
+ format-rust :
42
+ uv run cargo fmt
43
+ # Format the python code.
44
+ format-python :
45
+ uv run ruff format
36
46
37
47
# Generate a test coverage report.
38
- coverage language = " [rust|python]": (_run_lang language \
39
- " uv run cargo llvm-cov --lcov > lcov.info" \
40
- " uv run maturin develop && uv run pytest --cov=./ --cov-report=html"
41
- )
48
+ coverage : coverage-rust coverage-python
49
+ # Generate a test coverage report for the rust code.
50
+ coverage-rust * TEST_ARGS :
51
+ uv run cargo llvm-cov --lcov >lcov.info {{ TEST_ARGS}}
52
+ # Generate a test coverage report for the python code.
53
+ coverage-python * TEST_ARGS :
54
+ uv run maturin develop
55
+ uv run pytest --cov=./ --cov-report=html {{ TEST_ARGS}}
42
56
43
57
# Run Rust unsoundness checks using miri
44
58
miri * TEST_ARGS :
@@ -55,22 +69,3 @@ gen-extensions:
55
69
# Interactively update snapshot tests (requires `cargo-insta`)
56
70
update-snapshots :
57
71
cargo insta review
58
-
59
- # Runs a rust and a python command, depending on the `language` variable.
60
- #
61
- # If `language` is set to `rust` or `python`, only run the command for that language.
62
- # Otherwise, run both commands.
63
- _ run_lang language rust_cmd python_cmd :
64
- #!/usr/bin/env bash
65
- set -euo pipefail
66
- if [ " {{ language }} " = " rust" ]; then
67
- set -x
68
- {{ rust_cmd }}
69
- elif [ " {{ language }} " = " python" ]; then
70
- set -x
71
- {{ python_cmd }}
72
- else
73
- set -x
74
- {{ rust_cmd }}
75
- {{ python_cmd }}
76
- fi
0 commit comments