Backmerge master to staging (#2424) #989
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: E2E Subtensor Tests | |
concurrency: | |
group: e2e-subtensor-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: [main, development, staging] | |
pull_request: | |
branches: [main, development, staging] | |
types: [ opened, synchronize, reopened, ready_for_review ] | |
workflow_dispatch: | |
inputs: | |
verbose: | |
description: "Output more information when triggered manually" | |
required: false | |
default: "" | |
env: | |
CARGO_TERM_COLOR: always | |
VERBOSE: ${{ github.event.inputs.verbose }} | |
# job to run tests in parallel | |
jobs: | |
# Job to find all test files | |
find-tests: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} | |
outputs: | |
test-files: ${{ steps.get-tests.outputs.test-files }} | |
steps: | |
- name: Check-out repository under $GITHUB_WORKSPACE | |
uses: actions/checkout@v2 | |
- name: Find test files | |
id: get-tests | |
run: | | |
test_files=$(find tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))') | |
echo "::set-output name=test-files::$test_files" | |
shell: bash | |
# Job to run tests in parallel | |
run: | |
needs: find-tests | |
runs-on: SubtensorCI | |
timeout-minutes: 45 | |
strategy: | |
fail-fast: false # Allow other matrix jobs to run even if this job fails | |
max-parallel: 8 # Set the maximum number of parallel jobs | |
matrix: | |
rust-branch: | |
- nightly-2024-03-05 | |
rust-target: | |
- x86_64-unknown-linux-gnu | |
os: | |
- ubuntu-latest | |
test-file: ${{ fromJson(needs.find-tests.outputs.test-files) }} | |
env: | |
RELEASE_NAME: development | |
RUSTV: ${{ matrix.rust-branch }} | |
RUST_BACKTRACE: full | |
RUST_BIN_DIR: target/${{ matrix.rust-target }} | |
TARGET: ${{ matrix.rust-target }} | |
steps: | |
- name: Check-out repository under $GITHUB_WORKSPACE | |
uses: actions/checkout@v2 | |
- 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 ${{ matrix.rust-branch }} | |
uses: actions-rs/[email protected] | |
with: | |
toolchain: ${{ matrix.rust-branch }} | |
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 testnet | |
- name: Run tests | |
run: | | |
python3 -m pip install -e .[dev] pytest | |
LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" pytest ${{ matrix.test-file }} -s | |
- name: Retry failed tests | |
if: failure() | |
run: | | |
sleep 10 | |
python3 -m pip install -e .[dev] pytest | |
LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" pytest ${{ matrix.test-file }} -s |