Skip to content

Commit ca1b59b

Browse files
committed
merge devnet-ready
2 parents c93bebd + 7628080 commit ca1b59b

File tree

114 files changed

+13009
-2767
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+13009
-2767
lines changed

.dockerignore

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
1+
# IDE/Editor configs
12
.devcontainer
2-
.github
33
.vscode
4+
.idea
5+
*.swp
6+
*.swo
7+
8+
# Build artifacts
49
target/
10+
*.pyc
11+
*.pyo
12+
*.pyd
13+
__pycache__/
14+
15+
# Git-related
16+
.git
17+
.gitignore
18+
19+
# CI/CD
20+
.github
521
.dockerignore
22+
.gitattributes
23+
24+
# Dockerfiles
625
Dockerfile
26+
Dockerfile-localnet
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# .github/workflows/apply-benchmark-patch.yml
2+
name: Apply-Benchmark-Patch
3+
4+
on:
5+
pull_request:
6+
types: [labeled]
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
actions: read # required to list & download artifacts across workflows
12+
13+
jobs:
14+
apply:
15+
if: ${{ github.event.label.name == 'apply-benchmark-patch' }}
16+
runs-on: Benchmarking
17+
18+
steps:
19+
- name: Check out PR branch
20+
uses: actions/checkout@v4
21+
with:
22+
repository: ${{ github.event.pull_request.head.repo.full_name }}
23+
ref: ${{ github.event.pull_request.head.ref }}
24+
fetch-depth: 0
25+
26+
- name: Install GitHub CLI
27+
run: |
28+
sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get update
29+
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
30+
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
31+
32+
- name: Download latest bench patch artifact from heavy workflow
33+
uses: dawidd6/action-download-artifact@v3
34+
with:
35+
workflow: run-benchmarks.yml
36+
pr: ${{ github.event.pull_request.number }}
37+
name: bench-patch
38+
path: .
39+
allow_forks: true
40+
check_artifacts: true
41+
search_artifacts: true
42+
workflow_conclusion: ""
43+
if_no_artifact_found: warn
44+
45+
- name: Extract bench patch archive
46+
run: |
47+
set -euo pipefail
48+
if [ -f "bench-patch.tgz" ]; then
49+
tar -xzf bench-patch.tgz
50+
elif [ -f "bench-patch/bench-patch.tgz" ]; then
51+
tar -xzf bench-patch/bench-patch.tgz
52+
else
53+
echo "No bench-patch.tgz found after download."
54+
exit 0
55+
fi
56+
ls -la .bench_patch || true
57+
58+
- name: Apply and commit patch
59+
run: |
60+
set -euo pipefail
61+
62+
if [ ! -d ".bench_patch" ]; then
63+
echo "No .bench_patch directory found after extraction."
64+
exit 0
65+
fi
66+
67+
if [ -f ".bench_patch/summary.txt" ]; then
68+
echo "==== summary.txt ===="
69+
sed -n '1,200p' .bench_patch/summary.txt || true
70+
echo "====================="
71+
fi
72+
73+
if [ ! -f ".bench_patch/benchmark_patch.diff" ]; then
74+
echo "No benchmark_patch.diff found (no auto-patch created)."
75+
exit 0
76+
fi
77+
78+
git config user.name "github-actions[bot]"
79+
git config user.email "github-actions[bot]@users.noreply.github.com"
80+
81+
if ! git apply --index --3way .bench_patch/benchmark_patch.diff; then
82+
echo "Patch failed to apply cleanly. Please re-run Validate-Benchmarks to regenerate."
83+
exit 1
84+
fi
85+
86+
if git diff --cached --quiet; then
87+
echo "Patch applied but produced no changes (already up to date)."
88+
exit 0
89+
fi
90+
91+
echo "==== diff preview ===="
92+
git diff --cached --stat
93+
git diff --cached | head -n 120 || true
94+
echo "======================"
95+
96+
branch=$(git symbolic-ref --quiet --short HEAD || true)
97+
if [ -z "$branch" ]; then
98+
echo "Not on a branch - cannot push" >&2
99+
exit 1
100+
fi
101+
102+
git commit -m "auto-update benchmark weights"
103+
git push origin "HEAD:${branch}"
104+
105+
- name: Remove apply-benchmark-patch label
106+
if: ${{ success() }}
107+
run: |
108+
gh pr edit ${{ github.event.pull_request.number }} \
109+
--repo "${{ github.repository }}" \
110+
--remove-label "apply-benchmark-patch" || true

.github/workflows/check-bittensor-e2e-tests.yml.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ jobs:
110110

111111
build-image-with-current-branch:
112112
needs: check-label
113+
if: needs.check-label.outputs.skip-bittensor-e2e-tests == 'false'
113114
runs-on: [self-hosted, type-ccx33]
114115
steps:
115116
- name: Checkout code
@@ -211,12 +212,6 @@ jobs:
211212
- name: Retag Docker Image
212213
run: docker tag localnet ghcr.io/opentensor/subtensor-localnet:devnet-ready
213214

214-
# - name: Run tests
215-
# working-directory: ${{ github.workspace }}/btcli
216-
# run: |
217-
# source ${{ github.workspace }}/venv/bin/activate
218-
# uv run pytest ${{ matrix.test-file }} -s
219-
220215
- name: Run with retry
221216
working-directory: ${{ github.workspace }}/btcli
222217
run: |
@@ -311,12 +306,6 @@ jobs:
311306
- name: Retag Docker Image
312307
run: docker tag localnet ghcr.io/opentensor/subtensor-localnet:devnet-ready
313308

314-
# - name: Run tests
315-
# working-directory: ${{ github.workspace }}/bittensor
316-
# run: |
317-
# source ${{ github.workspace }}/venv/bin/activate
318-
# uv run pytest ${{ matrix.test-file }} -s
319-
320309
- name: Run with retry
321310
working-directory: ${{ github.workspace }}/bittensor
322311
run: |

.github/workflows/docker-localnet.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ permissions:
2828

2929
jobs:
3030
publish:
31-
runs-on: [self-hosted, type-ccx53, type-ccx43, type-ccx33]
31+
runs-on: SubtensorCI
3232

3333
steps:
3434
- name: Determine Docker tag and ref
@@ -51,6 +51,13 @@ jobs:
5151
with:
5252
ref: ${{ env.ref }}
5353

54+
- name: Show current Git branch
55+
run: |
56+
echo "==============================="
57+
echo "Current Git branch:"
58+
git rev-parse --abbrev-ref HEAD
59+
echo "==============================="
60+
5461
- name: Set up QEMU
5562
uses: docker/setup-qemu-action@v3
5663

@@ -79,3 +86,5 @@ jobs:
7986
tags: |
8087
ghcr.io/${{ github.repository }}-localnet:${{ env.tag }}
8188
${{ env.latest_tag == 'true' && format('ghcr.io/{0}-localnet:latest', github.repository) || '' }}
89+
cache-from: type=gha
90+
cache-to: type=gha,mode=max

.github/workflows/run-benchmarks.yml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# .github/workflows/benchmarks.yml
1+
# .github/workflows/run-benchmarks.yml
22
name: Validate-Benchmarks
33

44
on:
@@ -20,10 +20,8 @@ jobs:
2020

2121
env:
2222
SKIP_BENCHMARKS: "0"
23-
AUTO_COMMIT_WEIGHTS: "1"
2423

2524
steps:
26-
# ──────────────────────────────────────────────────────────────────
2725
- name: Check out PR branch
2826
if: ${{ env.SKIP_BENCHMARKS != '1' }}
2927
uses: actions/checkout@v4
@@ -124,16 +122,45 @@ jobs:
124122
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
125123
fi
126124
125+
- name: Ensure artifact folder exists
126+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
127+
run: mkdir -p .bench_patch
128+
127129
- name: Run & validate benchmarks
128130
if: ${{ env.SKIP_BENCHMARKS != '1' }}
129-
uses: nick-fields/retry@v3
131+
timeout-minutes: 180
132+
run: |
133+
chmod +x scripts/benchmark_action.sh
134+
scripts/benchmark_action.sh
135+
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+
147+
- name: Archive bench patch
148+
if: ${{ always() }}
149+
run: |
150+
if [ -d ".bench_patch" ]; then
151+
tar -czf bench-patch.tgz .bench_patch
152+
ls -lh bench-patch.tgz
153+
else
154+
echo "No .bench_patch directory to archive."
155+
fi
156+
157+
- name: Upload patch artifact (if prepared)
158+
if: ${{ always() }}
159+
uses: actions/upload-artifact@v4
130160
with:
131-
timeout_minutes: 180
132-
max_attempts: 3
133-
retry_wait_seconds: 60
134-
command: |
135-
chmod +x scripts/benchmark_action.sh
136-
scripts/benchmark_action.sh
161+
name: bench-patch
162+
path: bench-patch.tgz
163+
if-no-files-found: warn
137164

138165
# (6) — final check after run
139166
- name: Check skip label after run

0 commit comments

Comments
 (0)