5252 run-cli-tests : ${{ steps.get-labels.outputs.run-cli-tests }}
5353 steps :
5454 - name : Check out repository
55- uses : actions/checkout@v4
55+ uses : actions/checkout@v6
5656
5757 - name : Get labels from PR
5858 id : get-labels
@@ -74,15 +74,10 @@ jobs:
7474 outputs :
7575 test-files : ${{ steps.get-tests.outputs.test-files }}
7676 steps :
77- - name : Research preparation
78- working-directory : ${{ github.workspace }}
79- run : git clone https://github.com/opentensor/btcli.git
77+ - name : Clone btcli @ staging
78+ run : git clone --depth 1 --branch staging https://github.com/opentensor/btcli.git
8079
81- - name : Checkout
82- working-directory : ${{ github.workspace }}/btcli
83- run : git checkout staging
84-
85- - name : Install dependencies
80+ - name : Install jq
8681 run : sudo apt-get install -y jq
8782
8883 - name : Find e2e test files
@@ -107,7 +102,7 @@ jobs:
107102 run : docker save -o subtensor-localnet.tar ghcr.io/opentensor/subtensor-localnet:devnet-ready
108103
109104 - name : Upload Docker Image as Artifact
110- uses : actions/upload-artifact@v4
105+ uses : actions/upload-artifact@v7
111106 with :
112107 name : subtensor-localnet
113108 path : subtensor-localnet.tar
@@ -138,133 +133,107 @@ jobs:
138133 RUST_BACKTRACE : full
139134 RUST_BIN_DIR : target/${{ matrix.rust-target }}
140135 TARGET : ${{ matrix.rust-target }}
136+ VIRTUAL_ENV : ${{ github.workspace }}/btcli/.venv
141137
142138 timeout-minutes : 60
143139 name : " e2e tests: ${{ matrix.test-file }}"
144140 steps :
145- - name : Check-out repository
146- uses : actions/checkout@v4
141+ - name : Checkout PR branch of btwallet
142+ uses : actions/checkout@v6
143+ with :
144+ repository : ${{ github.event.pull_request.head.repo.full_name }}
145+ ref : ${{ github.event.pull_request.head.ref }}
146+ path : btwallet
147147
148148 - name : Install Rust stable
149- uses : actions-rs/ toolchain@v1.0.6
149+ uses : dtolnay/rust- toolchain@stable
150150 with :
151- toolchain : ${{ matrix.rust-branch }}
152151 components : rustfmt
153- profile : minimal
154152
155- - name : Install rust/cargo dependencies
153+ - name : Install system deps
156154 run : |
157- sudo apt-get update &&
155+ sudo apt-get update
158156 sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler jq
159157
160- - name : Add wasm32-unknown-unknown target
158+ - name : Add wasm32 target
161159 run : |
162160 rustup target add wasm32-unknown-unknown --toolchain stable-x86_64-unknown-linux-gnu
163161 rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu
164162
165163 - name : Install uv
166- uses : astral-sh/setup-uv@v5
167-
168- - name : Create Python virtual environment
169- working-directory : ${{ github.workspace }}
170- run : uv venv ${{ github.workspace }}/venv
164+ uses : astral-sh/setup-uv@v8.0.0
165+ with :
166+ enable-cache : true
171167
172- - name : Clone Bittensor CLI repo
173- working-directory : ${{ github.workspace }}
174- run : git clone https://github.com/opentensor/btcli.git
168+ - name : Clone btcli @ staging
169+ run : git clone --depth 1 --branch staging https://github.com/opentensor/btcli.git
175170
176- - name : Setup Bittensor-cli from cloned repo
177- working-directory : ${{ github.workspace }}/ btcli
171+ - name : Sync btcli env (locked) + maturin
172+ working-directory : btcli
178173 run : |
179- source ${{ github.workspace }}/venv/bin/activate
180- git checkout staging
181- git fetch origin staging
182- uv run --active pip install --upgrade pip
183- uv run --active pip install pytest
184- uv run --active pip install maturin
185- uv run --active pip install -e .[dev]
186-
187- - name : Clone Bittensor Wallet repo
188- run : git clone https://github.com/opentensor/btwallet.git
189-
190- - name : Checkout PR branch in Wallet repo
191- working-directory : ${{ github.workspace }}/btwallet
192- run : |
193- git fetch origin ${{ github.event.pull_request.head.ref }}
194- git checkout ${{ github.event.pull_request.head.ref }}
195- echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
174+ uv sync --group dev
175+ uv pip install maturin
176+ echo "${{ github.workspace }}/btcli/.venv/bin" >> $GITHUB_PATH
196177
197- - name : Build and install Rust Bittensor Wallet package
198- working-directory : ${{ github.workspace }}
199- run : |
200- source ${{ github.workspace }}/venv/bin/activate
201- uv run --active maturin develop
178+ - name : Build local btwallet into btcli venv
179+ working-directory : btwallet
180+ run : maturin develop
202181
203182 - name : Download Cached Docker Image
204- uses : actions/download-artifact@v4
183+ uses : actions/download-artifact@v8
205184 with :
206185 name : subtensor-localnet
207186
208187 - name : Load Docker Image
209188 run : docker load -i subtensor-localnet.tar
210189
211190 - name : Run tests
212- working-directory : ${{ github.workspace }}
213- run : |
214- source ${{ github.workspace }}/venv/bin/activate
215- pytest ${{ matrix.test-file }} -s
191+ working-directory : btcli
192+ run : pytest ${{ matrix.test-file }} -s
216193
217194
218195 run-unit-test :
219196 needs :
220197 - check-labels
221198 if : always() && needs.check-labels.outputs.run-cli-tests == 'true'
222199 runs-on : ubuntu-latest
200+ env :
201+ VIRTUAL_ENV : ${{ github.workspace }}/btcli/.venv
223202 steps :
224- - name : Check-out repository
225- uses : actions/checkout@v4
203+ - name : Checkout PR branch of btwallet
204+ uses : actions/checkout@v6
205+ with :
206+ repository : ${{ github.event.pull_request.head.repo.full_name }}
207+ ref : ${{ github.event.pull_request.head.ref }}
208+ path : btwallet
226209
227- - name : Install dependencies
210+ - name : Install system deps
228211 run : |
229- sudo apt-get update &&
212+ sudo apt-get update
230213 sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
231214
232- - name : Create Python virtual environment
233- working-directory : ${{ github.workspace }}
234- run : python3 -m venv venv
215+ - name : Install Rust stable
216+ uses : dtolnay/rust-toolchain@stable
217+
218+ - name : Install uv
219+ uses : astral-sh/setup-uv@v8.0.0
220+ with :
221+ enable-cache : true
235222
236- - name : Clone Bittensor CLI repo
237- working-directory : ${{ github.workspace }}
238- run : git clone https://github.com/opentensor/btcli.git
223+ - name : Clone btcli @ staging
224+ run : git clone --depth 1 --branch staging https://github.com/opentensor/btcli.git
239225
240- - name : Setup Bittensor SDK from cloned repo
241- working-directory : ${{ github.workspace }}/btcli
242- run : |
243- source ${{ github.workspace }}/venv/bin/activate
244- git checkout staging
245- git fetch origin staging
246- python3 -m pip install --upgrade pip
247- python3 -m pip install '.[dev]'
248- python3 -m pip install maturin
249-
250- - name : Clone Bittensor Wallet repo
251- run : git clone https://github.com/opentensor/btwallet.git
252-
253- - name : Checkout PR branch in Wallet repo
254- working-directory : ${{ github.workspace }}/btwallet
226+ - name : Sync btcli env (locked) + maturin
227+ working-directory : btcli
255228 run : |
256- git fetch origin ${{ github.event.pull_request.head.ref }}
257- git checkout ${{ github.event.pull_request.head.ref }}
258- echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
229+ uv sync --dev
230+ uv pip install maturin
231+ echo "${{ github.workspace }}/btcli/.venv/bin" >> $GITHUB_PATH
259232
260- - name : Build and install Rust Bittensor Wallet package
261- working-directory : ${{ github.workspace }}
262- run : |
263- source ${{ github.workspace }}/venv/bin/activate
264- maturin develop
233+ - name : Build local btwallet into btcli venv
234+ working-directory : btwallet
235+ run : maturin develop
265236
266- - name : Run SDK unit tests
267- working-directory : ${{ github.workspace }}
268- run : |
269- source ${{ github.workspace }}/venv/bin/activate
270- pytest ${{ github.workspace }}/btcli/tests/unit_tests
237+ - name : Run unit tests
238+ working-directory : btcli
239+ run : pytest tests/unit_tests
0 commit comments