-
Notifications
You must be signed in to change notification settings - Fork 24
/
Justfile
83 lines (67 loc) · 2.56 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
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 black pylint
# Run the black python linter
black fix="false":
#!/usr/bin/env bash
set -euxo pipefail
if [[ {{fix}} == "true" ]]; then
docker run --rm -t -v$(pwd):/code 'ubuntu:22.04' sh -c "apt-get update && apt-get -y install python3-pip && cd code && pip3 install --no-deps -r requirements.txt && pipenv install --system && cd nat-lab && pipenv install --system && black --color . && cd ../ci && black --color ."
else
docker run --rm -t -v$(pwd):/code 'ubuntu:22.04' sh -c "apt-get update && apt-get -y install python3-pip && cd code && pip3 install --no-deps -r requirements.txt && pipenv install --system && cd nat-lab && pipenv install --system && black --check --diff --color . && cd ../ci && black --check --diff --color ."
fi
pylint:
docker run --rm -t -v$(pwd):/code 'ubuntu:22.04' sh -c "apt-get update && apt-get -y install python3-pip && cd code && pip3 install --no-deps -r requirements.txt && pipenv install --system && cd nat-lab && pipenv install --system && pylint -f colorized . --ignore telio_bindings.py"
_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}}