-
Notifications
You must be signed in to change notification settings - Fork 2
/
justfile
113 lines (96 loc) · 3.99 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
109
110
111
112
113
_default:
@just --list
# Reset postgres and valkey
reset: reset-postgres reset-valkey
[private]
alias r := reset
# Reset postgres database
reset-postgres:
psql <<< 'drop schema public cascade; create schema public;'
[private]
alias rp := reset-postgres
# Reset valkey cache
reset-valkey:
valkey-cli flushdb
[private]
alias rv := reset-valkey
# Run unit and integration tests
test: test-unit test-extern test-valkey test-email test-postgres
[private]
alias t := test
# Run unit and integration tests with coverage
coverage: coverage-unit coverage-extern coverage-valkey coverage-email coverage-postgres
lcov -a .lcov-unit.info -a .lcov-extern.info -a .lcov-valkey.info -a .lcov-email.info -a .lcov-postgres.info -o .lcov-combined.info
genhtml -o .lcov_html .lcov-combined.info
[private]
alias cov := coverage
# Run unit tests
test-unit *args:
cargo test --locked --all-features --bins --lib {{args}}
cargo test --locked --all-features --doc {{args}}
[private]
alias tu := test-unit
# Run unit tests with coverage
coverage-unit *args:
cargo llvm-cov test --lcov --output-path .lcov-test.info --locked --all-features --bins --lib {{args}}
# cargo llvm-cov test --lcov --output-path .lcov-doc.info --locked --all-features --doc {{args}}
# lcov -a .lcov-test.info -a .lcov-doc.info -o .lcov-unit.info
cp .lcov-test.info .lcov-unit.info
{{ if is_dependency() == "false" { "genhtml -o .lcov_html .lcov-unit.info" } else { "" } }}
[private]
alias covu := coverage-unit
# Run postgres integration tests
test-postgres *args:
RUST_TEST_THREADS=1 cargo test -p academy_persistence_postgres --locked --all-features --test '*' {{args}}
[private]
alias tp := test-postgres
# Run postgres integration tests with coverage
coverage-postgres *args:
RUST_TEST_THREADS=1 cargo llvm-cov test --lcov --output-path .lcov-postgres.info -p academy_persistence_postgres --locked --all-features --test '*' {{args}}
{{ if is_dependency() == "false" { "genhtml -o .lcov_html .lcov-postgres.info" } else { "" } }}
[private]
alias covp := coverage-postgres
# Run valkey integration tests
test-valkey *args:
RUST_TEST_THREADS=1 cargo test -p academy_cache_valkey --locked --all-features --test '*' {{args}}
[private]
alias tv := test-valkey
# Run valkey integration tests with coverage
coverage-valkey *args:
RUST_TEST_THREADS=1 cargo llvm-cov test --lcov --output-path .lcov-valkey.info -p academy_cache_valkey --locked --all-features --test '*' {{args}}
{{ if is_dependency() == "false" { "genhtml -o .lcov_html .lcov-valkey.info" } else { "" } }}
[private]
alias covv := coverage-valkey
# Run email integration tests
test-email *args:
RUST_TEST_THREADS=1 cargo test -p academy_email_impl --locked --all-features --test '*' {{args}}
[private]
alias tm := test-email
# Run email integration tests with coverage
coverage-email *args:
RUST_TEST_THREADS=1 cargo llvm-cov test --lcov --output-path .lcov-email.info -p academy_email_impl --locked --all-features --test '*' {{args}}
{{ if is_dependency() == "false" { "genhtml -o .lcov_html .lcov-email.info" } else { "" } }}
[private]
alias covm := coverage-email
# Run extern integration tests
test-extern *args:
RUST_TEST_THREADS=1 cargo test -p academy_extern_impl --locked --all-features --test '*' {{args}}
[private]
alias te := test-extern
# Run extern integration tests with coverage
coverage-extern *args:
RUST_TEST_THREADS=1 cargo llvm-cov test --lcov --output-path .lcov-extern.info -p academy_extern_impl --locked --all-features --test '*' {{args}}
{{ if is_dependency() == "false" { "genhtml -o .lcov_html .lcov-extern.info" } else { "" } }}
[private]
alias cove := coverage-extern
# Run cargo fmt, cargo clippy and cargo test
check: && test
cargo fmt --check
cargo clippy --all-targets -- -D warnings
[private]
alias c := check
# Create files for a new postgres database migration
new-migration name:
touch "academy_persistence/postgres/migrations/$(date +%Y%m%d%H%M%S)_{{name}}".{up,down}.sql
[private]
alias nm := new-migration