-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJustfile
97 lines (78 loc) · 2.47 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
export MPLBACKEND := "Qt5Agg"
# Start development
start: clear
cargo run --quiet --bin scrap
# Run type checker
check: clear
cargo check
mypy scripts
# Run with backtrace on
@trace mode +command:
RUST_BACKTRACE={{mode}} just {{command}}
# Run `just +command` whenever some files is changed
@watch command +args='':
watchexec --restart --clear 'just {{command}} {{args}}'
# Run all kind of tests
test: unit integration
# Generate and open the documentation
docs +args='':
cargo doc --no-deps {{args}}
# Autoformat all code
format:
cargo fmt
black scripts
# Run linter check on all code
lint: clear
cargo clippy --tests
flake8 scripts
# Remove all artifacts but not with the dependencies
@clear: _clean-analyze
cargo clean $(cargo metadata --no-deps --format-version=1 | jq -r '["-p" + " " + .packages[].name] | join(" ")')
# Remove all artifacts including the dependencies
clean: _clean-analyze
cargo clean
pipenv clean
version_subjects := "Cargo.lock '**Dockerfile' 'packages/**/Cargo.toml'"
# Prepare for release
release version:
#!/usr/bin/env bash
./scripts/version.py {{version}} && cargo check
git add --ignore-removal {{version_subjects}}
TAG=`(git describe --abbrev=0 || echo 0.0.0) 2>/dev/null | ./scripts/version.py {{version}}`
git commit -S --edit --message "Release v${TAG}" \
&& git tag --annotate $TAG --message "$(git log -1 --pretty=%B)" --sign
./scripts/package.sh
if [ $? -ne 0 ]; then
git reset {{version_subjects}}
rm -r target/package
./scripts/version.py {{version}}- && cargo check
fi
# Run all debug/development build
build args='':
cargo build {{args}}
# Run all unit test
unit:
cargo test --lib --all --exclude s-crap -- --test-threads=1
# Run all integration test
integration:
cargo test --tests -p s-crap -- --test-threads=1
# Show reports of macro-benchmark
@stats git-flags='':
./scripts/summary.sh {{git-flags}} | ./scripts/perfsum.py
# Profile debug/development build
analyze +args: _clean-analyze
just build release
heaptrack ./target/release/scrap {{args}}
heaptrack --analyze heaptrack.*.zst &
./scripts/perfquick.sh './target/release/scrap {{args}}' | jq .
# Install all dependencies
install: install-toolchains
cargo build --all
pipenv install --dev
# Install all recommended toolchains
install-toolchains:
rustup component add rls rustfmt clippy rust-src rust-analysis
# pip install hooks4git hjson --user
# pipenv lock --requirements --dev | pipenv install --dev --requirements -
@_clean-analyze:
rm --force heaptrack.*.zst || true