-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathJustfile
More file actions
124 lines (99 loc) · 3.44 KB
/
Justfile
File metadata and controls
124 lines (99 loc) · 3.44 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
set shell := ["sh", "-c"]
# Aliases to be used only in interactive mode, please use full names when calling
# just in scripts or gitlab jobs.
[private]
alias t := test
[private]
alias c := clippy
[private]
alias u := udeps
[private]
alias un := unused
[private]
alias d := deny
[private]
alias p := prepush
nightly := "nightly-2025-08-07" # Matching stable version below, see: https://releases.rs/docs/1.89.0/
rust_stable := "1.89.0"
# Run all rust tests
test:
cargo test --all --quiet
# Run clippy
clippy package="" features="": _clippy-install
cargo clippy {{ if package == "" {"--lib"} else {"--package=" + package} }} {{ if features == "" {""} else {"--features=" + features} }} -- --deny warnings --allow unknown-lints -W clippy::expect_used -W clippy::panic -W clippy::unwrap_used -W clippy::indexing_slicing -W clippy::await_holding_lock -W clippy::large_futures
# Run udeps
udeps: _udeps-install
cargo +{{ nightly }} udeps --workspace --locked --output human --backend depinfo --release
# Run unused features
unused: _unused-install
#!/usr/bin/env bash
set -euxo pipefail
for dir in ./crates/* ./clis/*; do
pushd "$dir"
unused-features analyze -l debug
unused-features prune -l debug
popd
done
git restore Cargo.lock
if ! git diff --quiet; then
git diff
exit 1
fi
# Run deny
deny: _deny-install
cargo deny check
# Run rust pre-push checks
prepush: test clippy udeps unused deny python_checks format_markdown
python_checks: black pylint isort mypy autoflake
# Run the black python linter
[working-directory: 'nat-lab']
black fix="false":
#!/usr/bin/env bash
set -euxo pipefail
if [[ {{fix}} == "true" ]]; then
uv run --isolated black --color . && uv run --isolated black --color ../ci
else
uv run --isolated black --check --diff --color . && uv run --isolated black --check --diff --color ../ci
fi
# Run the pylint linter
[working-directory: 'nat-lab']
pylint:
uv run --isolated pylint -f colorized . --ignore telio_bindings.py
# Run the isort linter
[working-directory: 'nat-lab']
isort:
uv run --isolated isort --check-only --diff .
# Run mypy type checker
[working-directory: 'nat-lab']
mypy:
uv run --isolated mypy .
# Run the autoflake linter
[working-directory: 'nat-lab']
autoflake:
uv run --isolated autoflake --quiet --check .
format_markdown fix="false":
#!/usr/bin/env bash
set -euxo pipefail
if [[ {{fix}} == "true" ]]; then
docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.18.1 --fix
else
docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.18.1
fi
diagram:
uv run --isolated --with pyyaml==6.0.2 nat-lab/utils/generate_network_diagram.py nat-lab/docker-compose.yml nat-lab/network.md
changelog_test:
uv run --isolated --with regex==2024.5.15 ci/generate_changelog.py --test
_udeps-install: _nightly-install
cargo +{{ nightly }} install cargo-udeps@0.1.55 --locked
_unused-install: _rust_stable-install _rust-from-toolchain-file-install
cargo +1.92.0 install --git https://github.com/MTaliancich/cargo-unused-features.git --rev bc66e21323cbfd4cd21bb09a03298b592632e8e7
_deny-install:
cargo install --locked cargo-deny@0.18.9
_nightly-install:
rustup toolchain add {{ nightly }}
_rust_stable-install:
rustup toolchain add {{ rust_stable }}
_rust-from-toolchain-file-install:
rustup toolchain install
_clippy-install:
rustup component add clippy