Skip to content

Add pr-checks.yaml (sdk label only) #37

Add pr-checks.yaml (sdk label only)

Add pr-checks.yaml (sdk label only) #37

Workflow file for this run

name: Bittensor Checks
concurrency:
group: e2e-subtensor-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
- master
- staging
types: [opened, synchronize, reopened, labeled, unlabeled]
env:
CARGO_TERM_COLOR: always
VERBOSE: ${{ github.event.inputs.verbose }}
jobs:
check-labels:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.draft == false }}
outputs:
skip-tests: ${{ contains(github.event.pull_request.labels.*.name, 'skip-bittensor-tests') }}
run-cli-tests: ${{ contains(github.event.pull_request.labels.*.name, 'run-bittensor-cli-tests') }}
run-sdk-tests: ${{ contains(github.event.pull_request.labels.*.name, 'run-bittensor-sdk-tests') }}
steps:
- name: Check out repository
uses: actions/checkout@v4
run-sdk-tests:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false && needs.check-labels.outputs.run-sdk-tests == 'true' }}
timeout-minutes: 60
outputs:
test-files: ${{ steps.find-tests.outputs.test-files }}
strategy:
fail-fast: false
max-parallel: 8
matrix:
os:
- ubuntu-latest
test_file: ${{ fromJson(steps.find-tests.outputs.test-files) }}

Check failure on line 43 in .github/workflows/pr-checks.yml

View workflow run for this annotation

GitHub Actions / Bittensor Checks

Invalid workflow file

The workflow is not valid. .github/workflows/pr-checks.yml (Line: 43, Col: 20): Unrecognized named-value: 'steps'. Located at position 10 within expression: fromJson(steps.find-tests.outputs.test-files) .github/workflows/pr-checks.yml (Line: 43, Col: 20): Unexpected value '${{ fromJson(steps.find-tests.outputs.test-files) }}'
env:
RELEASE_NAME: development
RUSTV: stable
RUST_BACKTRACE: full
RUST_BIN_DIR: target/x86_64-unknown-linux-gnu
TARGET: x86_64-unknown-linux-gnu
steps:
- name: Check-out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update &&
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
- name: Install Rust stable
uses: actions-rs/[email protected]
with:
toolchain: stable
components: rustfmt
profile: minimal
- name: Add wasm32-unknown-unknown target
run: |
rustup target add wasm32-unknown-unknown --toolchain stable-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu
- name: Create python env
working-directory: ${{ github.workspace }}
run: python3 -m venv venv
- name: Clone Bittensor SDK repo
working-directory: ${{ github.workspace }}
run: git clone https://github.com/opentensor/bittensor.git
- name: Setup Bittensor SDK from cloned repo
working-directory: ${{ github.workspace }}/bittensor
run: |
source ${{ github.workspace }}/venv/bin/activate
git checkout staging
python3 -m pip install --upgrade pip
python3 -m pip install '.[dev]'
pip install maturin
- name: Find e2e test files
working-directory: ${{ github.workspace }}/bittensor
id: find-tests
run: |
test_files=$(find tests/e2e_tests -name "test_*.py" | jq -R -s -c 'split("\n")[:-1]')
echo "test-files=$test_files" >> $GITHUB_OUTPUT
- name: Clone bittensor-wallet repo
working-directory: ${{ github.workspace }}
run: git clone https://github.com/opentensor/btwallet.git
- name: Checkout PR branch
working-directory: ${{ github.workspace }}/btwallet
run: |
git fetch origin ${{ github.event.pull_request.head.ref }}
git checkout ${{ github.event.pull_request.head.ref }}
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
- name: Build and install Rust Bittensor Wallet package into python virtual environment
working-directory: ${{ github.workspace }}/btwallet
run: |
source ${{ github.workspace }}/venv/bin/activate
maturin develop
- name: Clone Subtensor repo
working-directory: ${{ github.workspace }}
run: git clone https://github.com/opentensor/subtensor.git
- name: Checkout Subtensor repo to `devnet-ready` branch
working-directory: ${{ github.workspace }}/subtensor
run: git checkout devnet-ready
- name: Run Bittensor SDK e2e test - ${{ matrix.test_file }}
working-directory: ${{ github.workspace }}/bittensor
run: |
source ${{ github.workspace }}/venv/bin/activate
if [ -f "${{ github.workspace }}/subtensor/scripts/localnet.sh" ]; then
LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" \
python3 -m pytest ${{ matrix.test_file }} -s
else
echo "Error: localnet.sh not found"
exit 1
fi