-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJustfile
125 lines (107 loc) · 4.08 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
114
115
116
117
118
119
120
121
122
123
124
125
set windows-shell := ["pwsh.exe", "-NoLogo", "-Command"]
set shell := ["bash", "-c"]
make_dir := if os_family() == "windows" {
"New-Item -ItemType Directory -Force"
} else {
"mkdir -p"
}
env_var_prefix := if os_family() == "windows" { "$env:" } else { "" }
env_var_postfix := if os_family() == "windows" { ";" } else { "" }
default: (build)
[group('dev')]
[doc('Build the project (default is debug)')]
build config="debug":
echo "Building the project..."
cargo build --workspace --all-features {{ if config=="release" {"--release"} else {""} }}
[group('dev')]
[doc('Build and run tests (default is debug)')]
test config="debug":
echo "Running tests..."
cargo test --workspace --all-features {{ if config=="release" {"--release"} else {""} }} -- --include-ignored
export LLVM_PROFILE_FILE:="./target/coverage/byte_knight-%p-%m.profraw"
[group('dev')]
[doc('Generate test coverage')]
coverage: (build "debug")
echo "Running tests with coverage..."
{{ make_dir }} target/coverage
{{env_var_prefix}}RUSTFLAGS="-Cinstrument-coverage"{{env_var_postfix}} \
cargo test --workspace -- --skip "perft"
grcov target/coverage engine/target/coverage chess/target/coverage -s . \
--binary-path ./target/debug/ --output-types lcov -o ./target/coverage/byte-knight.lcov \
--branch --keep-only "src/*" --keep-only "engine/*" --keep-only "chess/*" \
--ignore "src/bin/byte-knight/*" --ignore "chess/src/perft*"
[group('dev')]
[doc('Purge files generated by @coverage')]
purge-coverage:
echo "Purging coverage data..."
rm -rf *.profraw
rm -rf target/coverage
rm -rf chess/target
rm -rf engine/target
rm -rf chess/*.profraw
rm -rf engine/*.profraw
[group('dev')]
[doc('Create HTML report from coverage data')]
coverage-report:
echo "Generating HTML report..."
genhtml \
--branch \
-o ./target/coverage/html \
./target/coverage/byte-knight.lcov
[group('dev')]
[doc('Run clippy')]
lint:
cargo clippy --all --all-features --tests -- -D warnings
[group('chess')]
[group('performance')]
[doc('Run sarch benchmark - required before committing for OpenBench.')]
search-bench:
echo "Running search benchmark..."
cargo rustc --release --bin byte-knight -- -C target-cpu=native
./target/release/byte-knight bench
[group('chess')]
[doc('Run perft at a specified depth')]
perft depth:
echo "Running perft..."
cargo run --release --bin perft -- -d {{ depth }}
[group('chess')]
[doc('Run perft over the EPD test suite')]
perft-epd:
echo "Running EPD perft test suite..."
cargo run --release --bin perft -- --epd-file data/standard.epd
[group('chess')]
[group('performance')]
[doc('Run perft benchmark over the EPD test suite')]
perft-bench:
echo "Running perft benchmark..."
cargo run --release --bin perft-bench -- -e data/standard.epd
[group('chess')]
[doc('Generate magic numbers use for magic bitboards')]
magics:
echo "Generating magics..."
cargo run --release --bin generate_magics
[group('chess')]
[doc('Verify that generated Zobrist hashes are unique')]
verify-zobrist:
echo "Verifying Zobrist hash..."
cargo run --release --bin verify_zobrist
[group('dev')]
[doc('Generate release binaries for given target.')]
release target:
echo "Building release binaries..."
cargo rustc --release --bin byte-knight --target={{ target }}
[group('dev')]
[doc('Caches the release binary to bk-main for testing.')]
cache-main: (build "release")
echo "Caching binary for testing..."
cp target/release/byte-knight ./bk-main
[group('dev')]
[group('chess')]
[doc('Run the engine against itself. Requires @cache-main to be run first and fastchess to be installed.')]
compare-to-main engine1: (build "release")
echo "Comparing {{ engine1 }} to bk-main"
fastchess -engine cmd="{{ engine1 }}" name="dev" -engine cmd="./bk-main" name="bk-main" -openings file="./data/Pohl.epd" format=epd order=random -each tc=10+0.1 -rounds 200 -repeat -concurrency 8 -sprt elo0=0 elo1=5 alpha=0.05 beta=0.1 model=normalized -output format=cutechess
[group('dev')]
[doc('Format all Rust code')]
format:
cargo fmt --all