-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJustfile
89 lines (72 loc) · 2.52 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
@_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_to_file:
@mkdir -p target/
@just _taghunt "BUG" > target/BUG.tags
@just _taghunt "FIXME" > target/FIXME.tags
@just _taghunt "HACK" > target/HACK.tags
@just _taghunt "TODO" > target/TODO.tags
@just _taghunt "OQ" > target/OQ.tags
taghunt:
@just _taghunt_count "BUG" "FIXME" "HACK" "NOTE" "TODO" "OQ"
_taghunt TAG:
rg --glob \!Justfile --glob \!LOG.md --glob \!doc/ --glob \!assets/ {{TAG}} .
_taghunt_count *TAGS:
#!/usr/bin/env bash
for tag in {{TAGS}}; do
result=$(rg --glob \!Justfile --glob \!LOG.md --glob \!doc/ --glob \!assets/ $tag . | wc -l)
echo -n "$tag=$result<br/>"
done
echo