@@ -18,157 +18,65 @@ jobs:
1818 validate-benchmarks :
1919 runs-on : Benchmarking
2020
21- env :
22- SKIP_BENCHMARKS : " 0"
23-
2421 steps :
2522 - name : Check out PR branch
26- if : ${{ env.SKIP_BENCHMARKS != '1' }}
2723 uses : actions/checkout@v4
2824 with :
2925 repository : ${{ github.event.pull_request.head.repo.full_name }}
3026 ref : ${{ github.event.pull_request.head.ref }}
3127 fetch-depth : 0
3228
3329 - name : Install GitHub CLI
34- if : ${{ env.SKIP_BENCHMARKS != '1' }}
3530 run : |
3631 sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get update
37- sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install -y --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" gh
32+ sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install -y --no-install-recommends \
33+ -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" gh
3834 echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
3935
40- # (1) — first skip‑label check
41- - name : Check skip label
42- if : ${{ env.SKIP_BENCHMARKS != '1' }}
43- run : |
44- labels=$(gh pr view ${{ github.event.pull_request.number }} \
45- --repo "${{ github.repository }}" \
46- --json labels --jq '.labels[].name')
47- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
48- echo "skip-validate-benchmarks label found — skipping benchmarks."
49- echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
50- fi
51-
5236 - name : Install system dependencies
53- if : ${{ env.SKIP_BENCHMARKS != '1' }}
5437 run : |
55- sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get update
56- sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install -y --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" build-essential clang curl libssl-dev llvm libudev-dev protobuf-compiler pkg-config
57-
58- # (2)
59- - name : Check skip label
60- if : ${{ env.SKIP_BENCHMARKS != '1' }}
61- run : |
62- labels=$(gh pr view ${{ github.event.pull_request.number }} \
63- --repo "${{ github.repository }}" \
64- --json labels --jq '.labels[].name')
65- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
66- echo "skip-validate-benchmarks label found — skipping benchmarks."
67- echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
68- fi
38+ sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install -y --no-install-recommends \
39+ -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
40+ build-essential clang curl libssl-dev llvm libudev-dev protobuf-compiler pkg-config
6941
7042 - name : Install Rust toolchain
71- if : ${{ env.SKIP_BENCHMARKS != '1' }}
7243 uses : actions-rs/toolchain@v1
7344 with :
7445 profile : minimal
7546 toolchain : stable
7647
77- # (3)
78- - name : Check skip label
79- if : ${{ env.SKIP_BENCHMARKS != '1' }}
80- run : |
81- labels=$(gh pr view ${{ github.event.pull_request.number }} \
82- --repo "${{ github.repository }}" \
83- --json labels --jq '.labels[].name')
84- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
85- echo "skip-validate-benchmarks label found — skipping benchmarks."
86- echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
87- fi
88-
8948 - name : Cache Rust build
90- if : ${{ env.SKIP_BENCHMARKS != '1' }}
9149 uses : Swatinem/rust-cache@v2
9250 with :
9351 key : bench-${{ hashFiles('**/Cargo.lock') }}
9452 cache-on-failure : true
9553
96- # (4)
97- - name : Check skip label
98- if : ${{ env.SKIP_BENCHMARKS != '1' }}
99- run : |
100- labels=$(gh pr view ${{ github.event.pull_request.number }} \
101- --repo "${{ github.repository }}" \
102- --json labels --jq '.labels[].name')
103- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
104- echo "skip-validate-benchmarks label found — skipping benchmarks."
105- echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
106- fi
107-
108- - name : Build node with benchmarks
109- if : ${{ env.SKIP_BENCHMARKS != '1' }}
54+ - name : Build node with benchmarks + weight tools
11055 run : |
56+ .github/scripts/check-skip-label.sh ${{ github.event.pull_request.number }}
11157 cargo build --profile production -p node-subtensor --features runtime-benchmarks
112-
113- # (5)
114- - name : Check skip label
115- if : ${{ env.SKIP_BENCHMARKS != '1' }}
116- run : |
117- labels=$(gh pr view ${{ github.event.pull_request.number }} \
118- --repo "${{ github.repository }}" \
119- --json labels --jq '.labels[].name')
120- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
121- echo "skip-validate-benchmarks label found — skipping benchmarks."
122- echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
123- fi
124-
125- - name : Ensure artifact folder exists
126- if : ${{ env.SKIP_BENCHMARKS != '1' }}
127- run : mkdir -p .bench_patch
58+ .github/scripts/check-skip-label.sh ${{ github.event.pull_request.number }}
59+ cargo build --profile production -p subtensor-weight-tools --bin weight-compare
12860
12961 - name : Run & validate benchmarks
130- if : ${{ env.SKIP_BENCHMARKS != '1' }}
13162 timeout-minutes : 180
13263 run : |
64+ .github/scripts/check-skip-label.sh ${{ github.event.pull_request.number }}
65+ mkdir -p .bench_patch
13366 chmod +x scripts/benchmark_action.sh
13467 scripts/benchmark_action.sh
13568
136- - name : List artifact contents (for debugging)
137- if : ${{ always() }}
138- run : |
139- echo "Workspace: $GITHUB_WORKSPACE"
140- if [ -d ".bench_patch" ]; then
141- echo "== .bench_patch =="
142- ls -la .bench_patch || true
143- else
144- echo ".bench_patch directory is missing"
145- fi
146-
14769 - name : Archive bench patch
148- if : ${{ always() }}
70+ if : always()
14971 run : |
15072 if [ -d ".bench_patch" ]; then
15173 tar -czf bench-patch.tgz .bench_patch
152- ls -lh bench-patch.tgz
153- else
154- echo "No .bench_patch directory to archive."
15574 fi
15675
157- - name : Upload patch artifact (if prepared)
158- if : ${{ always() }}
76+ - name : Upload patch artifact
77+ if : always()
15978 uses : actions/upload-artifact@v4
16079 with :
16180 name : bench-patch
16281 path : bench-patch.tgz
16382 if-no-files-found : warn
164-
165- # (6) — final check after run
166- - name : Check skip label after run
167- if : ${{ env.SKIP_BENCHMARKS != '1' }}
168- run : |
169- labels=$(gh pr view ${{ github.event.pull_request.number }} \
170- --repo "${{ github.repository }}" \
171- --json labels --jq '.labels[].name')
172- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
173- echo "skip-validate-benchmarks label was found — but benchmarks already ran."
174- fi
0 commit comments