From 917f89c3a434ba439ff728625e826b1cff90c62b Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 8 Aug 2024 09:11:13 -0700 Subject: [PATCH] Adds e2e multiple versions script to master --- .../e2e-multiple-bittensor-tests.yml | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .github/workflows/e2e-multiple-bittensor-tests.yml diff --git a/.github/workflows/e2e-multiple-bittensor-tests.yml b/.github/workflows/e2e-multiple-bittensor-tests.yml new file mode 100644 index 000000000..470ccef4f --- /dev/null +++ b/.github/workflows/e2e-multiple-bittensor-tests.yml @@ -0,0 +1,115 @@ +name: E2E tests w/ multiple bittensor versions + +on: + workflow_dispatch: + inputs: + bittensor_versions: + description: 'Bittensor versions to test (comma-separated)' + required: true + default: '7.3.1,7.2.1' + bittensor_branch: + description: 'Branch of bittensor' + required: true + default: 'staging' + subtensor_branch: + description: 'Branch of subtensor' + required: true + default: 'testnet' + +env: + RUSTV: nightly-2024-03-05 + RUST_BACKTRACE: full + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Set up test matrix + id: set-matrix + run: | + versions=$(echo "${{ github.event.inputs.bittensor_versions }}" | jq -R -s -c 'split(",")| map(select(. != ""))') + echo "matrix=${versions}" >> $GITHUB_OUTPUT + + test: + needs: setup + runs-on: SubtensorCI + strategy: + fail-fast: false + matrix: + bittensor-version: ${{fromJson(needs.setup.outputs.matrix)}} + rust-target: + - x86_64-unknown-linux-gnu + env: + RUST_BIN_DIR: target/${{ matrix.rust-target }} + TARGET: ${{ matrix.rust-target }} + steps: + - name: Check-out repository + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.bittensor_branch }} + + - name: Print working directory + run: | + pwd + ls -la + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install tox + + - name: Install Rust dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler + + - name: Install Rust ${{ env.RUSTV }} + uses: actions-rs/toolchain@v1.0.6 + with: + toolchain: ${{ env.RUSTV }} + 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: Clone subtensor repo + run: git clone https://github.com/opentensor/subtensor.git + + - name: Setup subtensor repo + working-directory: ${{ github.workspace }}/subtensor + run: git checkout ${{ github.event.inputs.subtensor_branch }} + + - name: Create tox.ini + run: | + cd ../.. + cat << EOF > tox.ini + [tox] + envlist = bt-${{ matrix.bittensor-version }} + + [testenv] + deps = + pytest + pytest-asyncio + anyio + nest_asyncio + bittensor==${{ matrix.bittensor-version }} + commands = + pytest ${{ github.workspace }}/tests/e2e_tests -v -s {posargs} + passenv = + LOCALNET_SH_PATH + + [pytest] + asyncio_mode = auto + EOF + + - name: Run tox + env: + LOCALNET_SH_PATH: ${{ github.workspace }}/subtensor/scripts/localnet.sh + run: | + cd ../.. + tox -c tox.ini -e bt-${{ matrix.bittensor-version }}