forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjustfile
More file actions
107 lines (91 loc) · 3.82 KB
/
justfile
File metadata and controls
107 lines (91 loc) · 3.82 KB
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
set shell := ["bash", "-uc"]
default:
just --list
# ============================================================================
# Local benchmarking commands
# ============================================================================
# Test instrumented run using signet (includes report generation)
[group('local')]
test-instrumented commit datadir:
nix develop --command python3 bench.py build --skip-existing {{ commit }}:pr
nix develop --command python3 bench.py --profile quick run \
--benchmark-config bench/configs/pr.toml \
--matrix-entry 450-true \
--datadir {{ datadir }} \
pr:./binaries/pr/bitcoind
nix develop --command python3 bench.py report bench-output/ bench-output/
# Test uninstrumented run using signet
[group('local')]
test-uninstrumented commit datadir:
nix develop --command python3 bench.py build --skip-existing {{ commit }}:pr
nix develop --command python3 bench.py --profile quick run \
--benchmark-config bench/configs/pr.toml \
--matrix-entry 450-false \
--datadir {{ datadir }} \
pr:./binaries/pr/bitcoind
# Full benchmark with instrumentation (flamegraphs + plots)
[group('local')]
instrumented commit datadir:
python3 bench.py build {{ commit }}:pr
python3 bench.py run \
--benchmark-config bench/configs/pr.toml \
--matrix-entry 450-true \
--datadir {{ datadir }} \
pr:./binaries/pr/bitcoind
# Just build a binary (useful for incremental testing)
[group('local')]
build commit:
python3 bench.py build {{ commit }}
# Run benchmark with pre-built binary
[group('local')]
run datadir binary:
python3 bench.py run \
--benchmark-config bench/configs/pr.toml \
--matrix-entry 450-false \
--datadir {{ datadir }} \
{{ binary }}
# Generate plots from a debug.log file
[group('local')]
analyze commit logfile output_dir="./plots":
python3 bench.py analyze {{ commit }} {{ logfile }} --output-dir {{ output_dir }}
# Generate HTML report from benchmark results
[group('local')]
report input_dir output_dir nightly_history="":
#!/usr/bin/env bash
set -euo pipefail
if [ -n "{{ nightly_history }}" ]; then
python3 bench.py report {{ input_dir }} {{ output_dir }} --nightly-history {{ nightly_history }}
else
python3 bench.py report {{ input_dir }} {{ output_dir }}
fi
# ============================================================================
# CI commands (called by GitHub Actions)
# ============================================================================
# Build binary for CI
[group('ci')]
ci-build commit binaries_dir:
python3 bench.py build -o {{ binaries_dir }} {{ commit }}:pr
# Run benchmark for CI
[group('ci')]
ci-run benchmark_config matrix_entry datadir tmp_datadir output_dir binaries_dir:
python3 bench.py run \
--benchmark-config {{ benchmark_config }} \
--matrix-entry {{ matrix_entry }} \
--datadir {{ datadir }} \
--tmp-datadir {{ tmp_datadir }} \
--output-dir {{ output_dir }} \
pr:{{ binaries_dir }}/pr/bitcoind
# ============================================================================
# Git helpers
# ============================================================================
# Cherry-pick commits from a Bitcoin Core PR onto this branch
[group('git')]
pick-pr pr_number:
#!/usr/bin/env bash
set -euxo pipefail
if ! git remote get-url upstream 2>/dev/null | grep -q "bitcoin/bitcoin"; then
echo "Error: 'upstream' remote not found or doesn't point to bitcoin/bitcoin"
echo "Please add it with: git remote add upstream https://github.com/bitcoin/bitcoin.git"
exit 1
fi
git fetch upstream pull/{{ pr_number }}/head:bench-{{ pr_number }} && git cherry-pick $(git rev-list --reverse bench-{{ pr_number }} --not upstream/master)