-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathJustfile
108 lines (87 loc) · 2.6 KB
/
Justfile
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
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-2024-04-23"
rust1_80 := "1.80.0"
# Run all rust tests
test:
cargo test --all --quiet
# Run clippy
clippy:
cargo clippy --lib -- --deny warnings --allow unknown-lints -W clippy::expect_used -W clippy::panic -W clippy::unwrap_used
# Run udeps
udeps: _udeps-install
cargo +{{ nightly }} udeps --workspace --locked --output human --backend depinfo
# 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
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
# Start a dev web cgi server, for local teliod cgi development
web:
@echo "Go to http://127.0.0.1:8080/cgi-bin/teliod.cgi"
python3 -m http.server --cgi -d $(pwd)/contrib/http_root/ -b 127.0.0.1 8080
# 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 .
_udeps-install: _nightly-install
cargo +{{ nightly }} install [email protected] --locked
_unused-install: _rust1_80-install
cargo +{{ rust1_80 }} install --version 0.2.0 cargo-unused-features --locked
_deny-install:
cargo install --locked [email protected]
_nightly-install:
rustup toolchain add {{ nightly }}
_rust1_80-install:
rustup toolchain add {{ rust1_80}}