Skip to content

Commit 835a2c9

Browse files
authored
Merge pull request #2066 from opentensor/testnet
mainnet deploy 9/25/2025
2 parents 81ee047 + 3a266cb commit 835a2c9

File tree

112 files changed

+13527
-2970
lines changed

Some content is hidden

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

112 files changed

+13527
-2970
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

.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: 122 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
workflow_dispatch:
77
inputs:
88
branch-or-tag:
9-
description: "Branch or tag to use for the Docker image tag and ref to checkout (optional)"
9+
description: "The branch or tag to use as the Docker image tag (optional)."
1010
required: false
1111
default: ""
1212
push:
@@ -15,7 +15,7 @@ on:
1515
- main
1616
- testnet
1717
- devnet
18-
18+
1919
concurrency:
2020
group: docker-localnet-${{ github.ref }}
2121
cancel-in-progress: true
@@ -27,29 +27,130 @@ permissions:
2727
security-events: write
2828

2929
jobs:
30-
publish:
31-
runs-on: [self-hosted, type-ccx53, type-ccx43, type-ccx33]
32-
30+
setup:
31+
runs-on: ubuntu-latest
32+
outputs:
33+
tag: ${{ steps.vars.outputs.tag }}
34+
ref: ${{ steps.vars.outputs.ref }}
35+
latest_tag: ${{ steps.vars.outputs.latest_tag }}
3336
steps:
3437
- name: Determine Docker tag and ref
35-
id: tag
38+
id: vars
39+
run: |
40+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
41+
echo "ref=${{ github.head_ref }}" >> $GITHUB_OUTPUT
42+
echo "tag=${{ github.base_ref }}" >> $GITHUB_OUTPUT
43+
else
44+
tag="${{ github.event.inputs.branch-or-tag || github.ref_name }}"
45+
echo "ref=${{ github.ref_name }}" >> $GITHUB_OUTPUT
46+
echo "tag=$tag" >> $GITHUB_OUTPUT
47+
fi
48+
49+
if [[ "$tag" != "devnet-ready" ]]; then
50+
echo "latest_tag=true" >> $GITHUB_OUTPUT
51+
else
52+
echo "latest_tag=false" >> $GITHUB_OUTPUT
53+
fi
54+
55+
# build artifacts for fast-runtime and non-fast-runtime
56+
artifacts:
57+
name: Node • ${{ matrix.runtime }} • ${{ matrix.platform.arch }}
58+
needs: setup
59+
strategy:
60+
matrix:
61+
platform:
62+
# triple names used `in scripts/install_prebuilt_binaries.sh` file
63+
- runner: [self-hosted, type-ccx33]
64+
triple: x86_64-unknown-linux-gnu
65+
arch: amd64
66+
- runner: [ubuntu-24.04-arm]
67+
triple: aarch64-unknown-linux-gnu
68+
arch: arm64
69+
70+
runtime: ["fast-runtime", "non-fast-runtime"]
71+
72+
runs-on: ${{ matrix.platform.runner }}
73+
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v4
77+
with:
78+
ref: ${{ needs.setup.outputs.ref }}
79+
80+
- name: Install Rust + dependencies
81+
run: |
82+
chmod +x ./scripts/install_build_env.sh
83+
./scripts/install_build_env.sh
84+
85+
- name: Add Rust target triple
86+
run: |
87+
source "$HOME/.cargo/env"
88+
rustup target add ${{ matrix.platform.triple }}
89+
90+
- name: Patch limits for local run
3691
run: |
37-
branch_or_tag="${{ github.event.inputs.branch-or-tag || github.ref_name }}"
38-
echo "Determined branch or tag: $branch_or_tag"
39-
echo "tag=$branch_or_tag" >> $GITHUB_ENV
40-
echo "ref=$branch_or_tag" >> $GITHUB_ENV
41-
42-
# Check if this is a tagged release (not devnet-ready/devnet/testnet)
43-
if [[ "$branch_or_tag" != "devnet-ready" ]]; then
44-
echo "latest_tag=true" >> $GITHUB_ENV
92+
chmod +x ./scripts/localnet_patch.sh
93+
./scripts/localnet_patch.sh
94+
95+
- name: Build binaries
96+
run: |
97+
export PATH="$HOME/.cargo/bin:$PATH"
98+
export CARGO_BUILD_TARGET="${{ matrix.platform.triple }}"
99+
100+
if [ "${{ matrix.runtime }}" = "fast-runtime" ]; then
101+
./scripts/localnet.sh --build-only
45102
else
46-
echo "latest_tag=false" >> $GITHUB_ENV
103+
./scripts/localnet.sh False --build-only
47104
fi
48105
106+
# use `ci_target` name bc .dockerignore excludes `target`
107+
- name: Prepare artifacts for upload
108+
run: |
109+
RUNTIME="${{ matrix.runtime }}"
110+
TRIPLE="${{ matrix.platform.triple }}"
111+
112+
mkdir -p build/ci_target/${RUNTIME}/${TRIPLE}/release/
113+
cp -v target/${RUNTIME}/${TRIPLE}/release/node-subtensor \
114+
build/ci_target/${RUNTIME}/${TRIPLE}/release/
115+
116+
mkdir -p build/ci_target/${RUNTIME}/${TRIPLE}/release/wbuild/node-subtensor-runtime/
117+
cp -v target/${RUNTIME}/${TRIPLE}/release/wbuild/node-subtensor-runtime/node_subtensor_runtime.compact.compressed.wasm \
118+
build/ci_target/${RUNTIME}/${TRIPLE}/release/wbuild/node-subtensor-runtime/
119+
120+
- name: Upload artifact
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: binaries-${{ matrix.platform.triple }}-${{ matrix.runtime }}
124+
path: build/
125+
if-no-files-found: error
126+
127+
# Collect all artifacts and publish them to docker repo
128+
docker:
129+
needs: [setup, artifacts]
130+
runs-on: [self-hosted, type-ccx33]
131+
defaults:
132+
run:
133+
working-directory: ${{ github.workspace }}
134+
135+
steps:
49136
- name: Checkout code
50137
uses: actions/checkout@v4
51138
with:
52-
ref: ${{ env.ref }}
139+
ref: ${{ needs.setup.outputs.ref }}
140+
141+
- name: Download all binary artifacts
142+
uses: actions/download-artifact@v5
143+
with:
144+
pattern: binaries-*
145+
path: build/
146+
merge-multiple: true
147+
148+
- name: Show current Git branch
149+
run: |
150+
echo "==============================="
151+
echo "Current Git branch:"
152+
git rev-parse --abbrev-ref HEAD
153+
echo "==============================="
53154
54155
- name: Set up QEMU
55156
uses: docker/setup-qemu-action@v3
@@ -64,18 +165,16 @@ jobs:
64165
username: ${{ github.actor }}
65166
password: ${{ secrets.GITHUB_TOKEN }}
66167

67-
- name: Patch non-fast-block node
68-
run: |
69-
chmod +x ./scripts/localnet_patch.sh
70-
./scripts/localnet_patch.sh
71-
72168
- name: Build and push Docker image
73169
uses: docker/build-push-action@v6
74170
with:
75171
context: .
76172
file: Dockerfile-localnet
173+
build-args: |
174+
BUILT_IN_CI="Boom shakalaka"
175+
77176
push: true
78177
platforms: linux/amd64,linux/arm64
79178
tags: |
80-
ghcr.io/${{ github.repository }}-localnet:${{ env.tag }}
81-
${{ env.latest_tag == 'true' && format('ghcr.io/{0}-localnet:latest', github.repository) || '' }}
179+
ghcr.io/${{ github.repository }}-localnet:${{ needs.setup.outputs.tag }}
180+
${{ needs.setup.outputs.latest_tag == 'true' && format('ghcr.io/{0}-localnet:latest', github.repository) || '' }}

0 commit comments

Comments
 (0)