-
Notifications
You must be signed in to change notification settings - Fork 18
/
.justfile
88 lines (75 loc) · 3.82 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
# just manual: https://github.com/casey/just/#readme
# Ignore the .env file that is only used by the web service
set dotenv-load := false
_default:
@just --list
# Format source code
fmt:
cargo fmt --all
cd ofdb-app-clearance && cargo fmt
cd ofdb-frontend && cargo fmt
# Check all crates individually (takes a long time)
check:
cargo check --locked --all-features --all-targets -p ofdb-application
cargo check --locked --all-features --all-targets -p ofdb-boundary
cargo check --locked --all-features --all-targets -p ofdb-core
cargo check --locked --all-features --all-targets -p ofdb-entities
cargo check --locked --all-features --all-targets -p ofdb-db-sqlite
cargo check --locked --all-features --all-targets -p ofdb-db-tantivy
cargo check --locked --all-features --all-targets -p ofdb-frontend-api
cargo check --locked --all-features --all-targets -p ofdb-gateways
cargo check --locked --all-features --all-targets -p ofdb-webserver
# Run clippy on the workspace (both dev and release profile)
clippy:
cargo clippy --locked --workspace --all-targets --no-deps --profile dev -- -D warnings --cap-lints warn
cargo clippy --locked --workspace --all-targets --no-deps --profile release -- -D warnings --cap-lints warn
cd ofdb-app-clearance && cargo clippy --locked --no-deps --target wasm32-unknown-unknown --all-features --all-targets --profile dev -- -D warnings --cap-lints warn
cd ofdb-app-clearance && cargo clippy --locked --no-deps --target wasm32-unknown-unknown --all-features --all-targets --profile release -- -D warnings --cap-lints warn
cd ofdb-frontend && cargo clippy --locked --no-deps --target wasm32-unknown-unknown --all-features --all-targets --profile release -- -D warnings --cap-lints warn
cd ofdb-frontend && cargo clippy --locked --no-deps --target wasm32-unknown-unknown --all-features --all-targets --profile dev -- -D warnings --cap-lints warn
# Fix lint warnings
fix:
cargo fix --locked --workspace --all-features --all-targets
cargo clippy --locked --workspace --no-deps --all-features --all-targets --fix
cd ofdb-app-clearance && cargo fix --locked --target wasm32-unknown-unknown --all-features --all-targets
cd ofdb-app-clearance && cargo clippy --locked --no-deps --target wasm32-unknown-unknown --all-features --all-targets --fix
cd ofdb-frontend && cargo fix --locked --target wasm32-unknown-unknown --all-features --all-targets
cd ofdb-frontend && cargo clippy --locked --no-deps --target wasm32-unknown-unknown --all-features --all-targets --fix
# Run tests
test:
RUST_BACKTRACE=1 RUST_LOG=info cargo test --locked --workspace --all-features -- --nocapture
RUST_BACKTRACE=1 RUST_LOG=info cd ofdb-app-clearance && cargo test --locked --all-features -- --nocapture
RUST_BACKTRACE=1 RUST_LOG=info cd ofdb-frontend && cargo test --locked --all-features -- --nocapture
# Set up (and update) tooling
setup:
# Ignore rustup failures, because not everyone might use it
rustup self update || true
# cargo-edit is needed for `cargo upgrade`
cargo install cargo-edit
pip install -U pre-commit
# pre-commit install --hook-type commit-msg --hook-type pre-commit
# Upgrade (and update) dependencies and tools
upgrade:
pre-commit autoupdate
cargo upgrade \
--exclude libsqlite3-sys
cargo update
cd ofdb-app-clearance \
&& cargo upgrade \
&& cargo update
cd ofdb-frontend \
&& cargo upgrade \
&& cargo update
# Run pre-commit hooks
pre-commit:
pre-commit run --all-files
# Build frontend
build-frontend:
cd ofdb-frontend && tailwind -i src/style.css -o style.css --minify
cd ofdb-frontend && trunk build --release
# Build clearance app
build-clearance:
cd ofdb-app-clearance && trunk build --release
# Run
run: build-clearance
RUST_LOG=debug,tantivy=info cargo run