@@ -19,123 +19,124 @@ jobs:
19
19
runs-on : Benchmarking
20
20
21
21
env :
22
- SKIP_BENCHMARKS : ' 0 '
23
- AUTO_COMMIT_WEIGHTS : ' 1 '
22
+ SKIP_BENCHMARKS : " 0 "
23
+ AUTO_COMMIT_WEIGHTS : " 1 "
24
24
25
25
steps :
26
- # ──────────────────────────────────────────────────────────────────
27
- - name : Check out PR branch
28
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
29
- uses : actions/checkout@v4
30
- with :
31
- repository : ${{ github.event.pull_request.head.repo.full_name }}
32
- ref : ${{ github.event.pull_request.head.ref }}
33
- fetch-depth : 0
34
-
35
- - name : Install GitHub CLI
36
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
37
- run : |
38
- sudo apt-get update
39
- sudo apt-get install -y gh
40
- echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
41
-
42
- # (1) — first skip‑label check
43
- - name : Check skip label
44
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
45
- run : |
46
- labels=$(gh pr view ${{ github.event.pull_request.number }} \
47
- --repo "${{ github.repository }}" \
48
- --json labels --jq '.labels[].name')
49
- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
50
- echo "skip-validate-benchmarks label found — skipping benchmarks."
51
- echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
52
- fi
53
-
54
- - name : Install system dependencies
55
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
56
- run : |
57
- sudo apt-get update
58
- sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
59
-
60
- # (2)
61
- - name : Check skip label
62
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
63
- run : |
64
- labels=$(gh pr view ${{ github.event.pull_request.number }} \
65
- --repo "${{ github.repository }}" \
66
- --json labels --jq '.labels[].name')
67
- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
68
- echo "skip-validate-benchmarks label found — skipping benchmarks."
69
- echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
70
- fi
71
-
72
- - name : Install Rust toolchain
73
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
74
- uses : actions-rs/toolchain@v1
75
- with :
76
- profile : minimal
77
- toolchain : stable
78
-
79
- # (3)
80
- - name : Check skip label
81
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
82
- run : |
83
- labels=$(gh pr view ${{ github.event.pull_request.number }} \
84
- --repo "${{ github.repository }}" \
85
- --json labels --jq '.labels[].name')
86
- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
87
- echo "skip-validate-benchmarks label found — skipping benchmarks."
88
- echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
89
- fi
90
-
91
- - name : Cache Rust build
92
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
93
- uses : Swatinem/rust-cache@v2
94
- with :
95
- key : bench-${{ hashFiles('**/Cargo.lock') }}
96
-
97
- # (4)
98
- - name : Check skip label
99
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
100
- run : |
101
- labels=$(gh pr view ${{ github.event.pull_request.number }} \
102
- --repo "${{ github.repository }}" \
103
- --json labels --jq '.labels[].name')
104
- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
105
- echo "skip-validate-benchmarks label found — skipping benchmarks."
106
- echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
107
- fi
108
-
109
- - name : Build node with benchmarks
110
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
111
- run : |
112
- cargo build --profile production -p node-subtensor --features runtime-benchmarks
113
-
114
- # (5)
115
- - name : Check skip label
116
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
117
- run : |
118
- labels=$(gh pr view ${{ github.event.pull_request.number }} \
119
- --repo "${{ github.repository }}" \
120
- --json labels --jq '.labels[].name')
121
- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
122
- echo "skip-validate-benchmarks label found — skipping benchmarks."
123
- echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
124
- fi
125
-
126
- - name : Run & validate benchmarks
127
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
128
- run : |
129
- chmod +x scripts/benchmark_action.sh
130
- scripts/benchmark_action.sh
131
-
132
- # (6) — final check after run
133
- - name : Check skip label after run
134
- if : ${{ env.SKIP_BENCHMARKS != '1' }}
135
- run : |
136
- labels=$(gh pr view ${{ github.event.pull_request.number }} \
137
- --repo "${{ github.repository }}" \
138
- --json labels --jq '.labels[].name')
139
- if echo "$labels" | grep -q "skip-validate-benchmarks"; then
140
- echo "skip-validate-benchmarks label was found — but benchmarks already ran."
141
- fi
26
+ # ──────────────────────────────────────────────────────────────────
27
+ - name : Check out PR branch
28
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
29
+ uses : actions/checkout@v4
30
+ with :
31
+ repository : ${{ github.event.pull_request.head.repo.full_name }}
32
+ ref : ${{ github.event.pull_request.head.ref }}
33
+ fetch-depth : 0
34
+
35
+ - name : Install GitHub CLI
36
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
37
+ run : |
38
+ sudo apt-get update
39
+ sudo apt-get install -y gh
40
+ echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
41
+
42
+ # (1) — first skip‑label check
43
+ - name : Check skip label
44
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
45
+ run : |
46
+ labels=$(gh pr view ${{ github.event.pull_request.number }} \
47
+ --repo "${{ github.repository }}" \
48
+ --json labels --jq '.labels[].name')
49
+ if echo "$labels" | grep -q "skip-validate-benchmarks"; then
50
+ echo "skip-validate-benchmarks label found — skipping benchmarks."
51
+ echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
52
+ fi
53
+
54
+ - name : Install system dependencies
55
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
56
+ run : |
57
+ sudo apt-get update
58
+ sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
59
+
60
+ # (2)
61
+ - name : Check skip label
62
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
63
+ run : |
64
+ labels=$(gh pr view ${{ github.event.pull_request.number }} \
65
+ --repo "${{ github.repository }}" \
66
+ --json labels --jq '.labels[].name')
67
+ if echo "$labels" | grep -q "skip-validate-benchmarks"; then
68
+ echo "skip-validate-benchmarks label found — skipping benchmarks."
69
+ echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
70
+ fi
71
+
72
+ - name : Install Rust toolchain
73
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
74
+ uses : actions-rs/toolchain@v1
75
+ with :
76
+ profile : minimal
77
+ toolchain : stable
78
+
79
+ # (3)
80
+ - name : Check skip label
81
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
82
+ run : |
83
+ labels=$(gh pr view ${{ github.event.pull_request.number }} \
84
+ --repo "${{ github.repository }}" \
85
+ --json labels --jq '.labels[].name')
86
+ if echo "$labels" | grep -q "skip-validate-benchmarks"; then
87
+ echo "skip-validate-benchmarks label found — skipping benchmarks."
88
+ echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
89
+ fi
90
+
91
+ - name : Cache Rust build
92
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
93
+ uses : Swatinem/rust-cache@v2
94
+ with :
95
+ key : bench-${{ hashFiles('**/Cargo.lock') }}
96
+ cache-on-failure : true
97
+
98
+ # (4)
99
+ - name : Check skip label
100
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
101
+ run : |
102
+ labels=$(gh pr view ${{ github.event.pull_request.number }} \
103
+ --repo "${{ github.repository }}" \
104
+ --json labels --jq '.labels[].name')
105
+ if echo "$labels" | grep -q "skip-validate-benchmarks"; then
106
+ echo "skip-validate-benchmarks label found — skipping benchmarks."
107
+ echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
108
+ fi
109
+
110
+ - name : Build node with benchmarks
111
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
112
+ run : |
113
+ cargo build --profile production -p node-subtensor --features runtime-benchmarks
114
+
115
+ # (5)
116
+ - name : Check skip label
117
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
118
+ run : |
119
+ labels=$(gh pr view ${{ github.event.pull_request.number }} \
120
+ --repo "${{ github.repository }}" \
121
+ --json labels --jq '.labels[].name')
122
+ if echo "$labels" | grep -q "skip-validate-benchmarks"; then
123
+ echo "skip-validate-benchmarks label found — skipping benchmarks."
124
+ echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
125
+ fi
126
+
127
+ - name : Run & validate benchmarks
128
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
129
+ run : |
130
+ chmod +x scripts/benchmark_action.sh
131
+ scripts/benchmark_action.sh
132
+
133
+ # (6) — final check after run
134
+ - name : Check skip label after run
135
+ if : ${{ env.SKIP_BENCHMARKS != '1' }}
136
+ run : |
137
+ labels=$(gh pr view ${{ github.event.pull_request.number }} \
138
+ --repo "${{ github.repository }}" \
139
+ --json labels --jq '.labels[].name')
140
+ if echo "$labels" | grep -q "skip-validate-benchmarks"; then
141
+ echo "skip-validate-benchmarks label was found — but benchmarks already ran."
142
+ fi
0 commit comments