2828 check-label :
2929 runs-on : ubuntu-latest
3030 outputs :
31- skip-bittensor-e2e-tests : ${{ steps.get-labels.outputs.skip-bittensor-e2e-tests }}
31+ skip-bittensor-e2e-tests : ${{ steps.get-labels.outputs.skip-bittensor-e2e-tests || steps.set-default.outputs.skip-bittensor-e2e-tests }}
3232 steps :
3333 - name : Install dependencies
3434 run : |
@@ -38,11 +38,12 @@ jobs:
3838 - name : Check out repository
3939 uses : actions/checkout@v4
4040 with :
41- repository : ${{ github.event.pull_request.head.repo.full_name }}
42- ref : ${{ github.event.pull_request.head.ref }}
41+ repository : ${{ github.event.pull_request.head.repo.full_name || github.repository }}
42+ ref : ${{ github.event.pull_request.head.ref || github.ref_name }}
4343
4444 - name : Get labels from PR
4545 id : get-labels
46+ if : github.event_name == 'pull_request'
4647 run : |
4748 LABELS=$(gh pr -R ${{ github.repository }} view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
4849 echo "Current labels: $LABELS"
5455 env :
5556 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5657
58+ - name : Set default skip value for workflow_dispatch
59+ id : set-default
60+ if : github.event_name == 'workflow_dispatch'
61+ run : |
62+ echo "skip-bittensor-e2e-tests=false" >> $GITHUB_OUTPUT
63+
5764 find-btcli-e2e-tests :
5865 needs : check-label
5966 if : needs.check-label.outputs.skip-bittensor-e2e-tests == 'false'
@@ -108,27 +115,102 @@ jobs:
108115 echo "test-files=$test_files" >> $GITHUB_OUTPUT
109116 shell : bash
110117
111- build-image-with-current-branch :
118+ # build artifacts for non-fast-runtime (e2e tests only need this)
119+ artifacts :
120+ name : Node • ${{ matrix.runtime }} • ${{ matrix.platform.arch }}
112121 needs : check-label
113122 if : needs.check-label.outputs.skip-bittensor-e2e-tests == 'false'
123+ strategy :
124+ matrix :
125+ platform :
126+ - triple : x86_64-unknown-linux-gnu
127+ arch : amd64
128+ runtime : ["non-fast-runtime"]
129+
114130 runs-on : ubuntu-latest
131+
115132 steps :
116133 - name : Checkout code
117134 uses : actions/checkout@v4
118135 with :
119- repository : ${{ github.event.pull_request.head.repo.full_name }}
120- ref : ${{ github.event.pull_request.head.ref }}
136+ repository : ${{ github.event.pull_request.head.repo.full_name || github.repository }}
137+ ref : ${{ github.event.pull_request.head.ref || github.ref_name }}
138+
139+ - name : Install Rust + dependencies
140+ run : |
141+ chmod +x ./scripts/install_build_env.sh
142+ ./scripts/install_build_env.sh
121143
122- - name : Patch non-fast-runtime node
144+ - name : Add Rust target triple
145+ run : |
146+ source "$HOME/.cargo/env"
147+ rustup target add ${{ matrix.platform.triple }}
148+
149+ - name : Patch limits for local run
123150 run : |
124151 chmod +x ./scripts/localnet_patch.sh
125152 ./scripts/localnet_patch.sh
126153
127- - name : Set up QEMU
128- uses : docker/setup-qemu-action@v3
154+ - name : Build binaries
155+ run : |
156+ export PATH="$HOME/.cargo/bin:$PATH"
157+ export CARGO_BUILD_TARGET="${{ matrix.platform.triple }}"
158+
159+ ./scripts/localnet.sh False --build-only
160+
161+ # use `ci_target` name bc .dockerignore excludes `target`
162+ - name : Prepare artifacts for upload
163+ run : |
164+ RUNTIME="${{ matrix.runtime }}"
165+ TRIPLE="${{ matrix.platform.triple }}"
166+
167+ # Verify binaries exist before copying
168+ BINARY_PATH="target/${RUNTIME}/${TRIPLE}/release/node-subtensor"
169+ WASM_PATH="target/${RUNTIME}/${TRIPLE}/release/wbuild/node-subtensor-runtime/node_subtensor_runtime.compact.compressed.wasm"
170+
171+ if [[ ! -f "$BINARY_PATH" ]]; then
172+ echo "❌ Error: Binary not found at $BINARY_PATH"
173+ exit 1
174+ fi
175+
176+ if [[ ! -f "$WASM_PATH" ]]; then
177+ echo "❌ Error: WASM file not found at $WASM_PATH"
178+ exit 1
179+ fi
180+
181+ mkdir -p build/ci_target/${RUNTIME}/${TRIPLE}/release/
182+ cp -v "$BINARY_PATH" \
183+ build/ci_target/${RUNTIME}/${TRIPLE}/release/
184+
185+ mkdir -p build/ci_target/${RUNTIME}/${TRIPLE}/release/wbuild/node-subtensor-runtime/
186+ cp -v "$WASM_PATH" \
187+ build/ci_target/${RUNTIME}/${TRIPLE}/release/wbuild/node-subtensor-runtime/
129188
130- - name : Set up Docker Buildx
131- uses : docker/setup-buildx-action@v3
189+ - name : Upload artifact
190+ uses : actions/upload-artifact@v4
191+ with :
192+ name : binaries-${{ matrix.platform.triple }}-${{ matrix.runtime }}
193+ path : build/
194+ if-no-files-found : error
195+
196+ # Collect all artifacts and build a Docker image
197+ build-image-with-current-branch :
198+ needs : [check-label, artifacts]
199+ if : needs.check-label.outputs.skip-bittensor-e2e-tests == 'false'
200+ runs-on : ubuntu-latest
201+ steps :
202+ - name : Checkout code
203+ uses : actions/checkout@v4
204+ with :
205+ repository : ${{ github.event.pull_request.head.repo.full_name || github.repository }}
206+ ref : ${{ github.event.pull_request.head.ref || github.ref_name }}
207+
208+ - name : Download all binary artifacts
209+ uses : actions/download-artifact@v5
210+ with :
211+ pattern : binaries-*
212+ path : build/
213+ merge-multiple : true
132214
133215 - name : Move Docker data-root to /mnt/data
134216 run : |
@@ -185,8 +267,8 @@ jobs:
185267 - name : Check-out repository
186268 uses : actions/checkout@v4
187269 with :
188- repository : ${{ github.event.pull_request.head.repo.full_name }}
189- ref : ${{ github.event.pull_request.head.ref }}
270+ repository : ${{ github.event.pull_request.head.repo.full_name || github.repository }}
271+ ref : ${{ github.event.pull_request.head.ref || github.ref_name }}
190272
191273 - name : Install uv
192274 uses : astral-sh/setup-uv@v5
@@ -279,8 +361,8 @@ jobs:
279361 - name : Check-out repository
280362 uses : actions/checkout@v4
281363 with :
282- repository : ${{ github.event.pull_request.head.repo.full_name }}
283- ref : ${{ github.event.pull_request.head.ref }}
364+ repository : ${{ github.event.pull_request.head.repo.full_name || github.repository }}
365+ ref : ${{ github.event.pull_request.head.ref || github.ref_name }}
284366
285367 - name : Install uv
286368 uses : astral-sh/setup-uv@v5
0 commit comments