-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
79 lines (62 loc) · 2.1 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
@_default:
just --list
# Run the CI pipeline
ci *ARGS: doctest nextest
# Run the tests
nextest *ARGS:
cargo nextest run --no-fail-fast {{ARGS}}
# Run the doctests, which aren't done by nextest
doctest:
cargo test --doc
# Dev Loop
test *ARGS:
#!/usr/bin/env bash
set -euo pipefail
delta_time() {
local THRESHOLD_FOR_RERUN=300
local current_time=$(date +%s)
if [ -e ./.last_run ]; then
local last_run=$(cat ./.last_run)
local delta=$((${current_time} - ${last_run}))
if [ $delta -lt $THRESHOLD_FOR_RERUN ]; then
echo "Last run was ${delta} < ${THRESHOLD_FOR_RERUN} seconds ago, skipping"
return 1
fi
fi
echo "${current_time}" > ./.last_run
return 0
}
if [[ -n "{{ARGS}}" ]]; then
echo "Running tests with args: {{ARGS}}"
just nextest {{ARGS}}
else
echo "Smoke Check"
just doctest
if [[ ! -e ./.lcov ]] || delta_time; then
echo "Refreshing coverage data"
just coverage
else
echo "Using cached coverage data"
just nextest
fi
fi
coverage:
cargo llvm-cov nextest --no-fail-fast --lcov --output-path ./.lcov
bench:
# TODO: Set up a Self-hosted runner with known specs to run benchmarks on on CI.
cargo bench
miri-test:
cargo miri nextest run --no-fail-fast --all-targets
cloc *args:
cloc --vcs=git --exclude-ext=.rc . {{args}}
mutants *ARGS:
# cargo mutants -t 90 -j 8 -E 'bitboard' -E "intrinsics" -E "Mask" -E "tokio" -E "Stockfish" -E "ui" -E "PEXTBoard" --test-tool nextest -- --cargo-profile=mutants --all-targets {{ARGS}} -j 4
cargo mutants -j 4 -E 'bitboard' -E "intrinsics" -E "Mask" -E "tokio" -E "Stockfish" -E "ui" -E "PEXTBoard" --test-tool nextest -- --cargo-profile=mutants --all-targets {{ARGS}} -j 4
taghunt:
@just _taghunt "BUG" "FIXME" "HACK" "NOTE" "TODO" "OQ"
_taghunt *TAGS:
#!/usr/bin/env bash
for tag in {{TAGS}}; do
echo -n "$tag=$(rg --glob \!Justfile $tag . | wc -l)<br/>"
done
echo