From d1ee62035de6745efccdbcfcfa9cfc1b26cb8193 Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 17 May 2024 17:42:51 +0400 Subject: [PATCH 1/3] feat: e2e bittensor tests --- .github/workflows/check-rust.yml | 2 +- .github/workflows/e2e-bittensor-tests.yml | 81 +++++++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/e2e-bittensor-tests.yml diff --git a/.github/workflows/check-rust.yml b/.github/workflows/check-rust.yml index 28c7358bc..fee14aa55 100644 --- a/.github/workflows/check-rust.yml +++ b/.github/workflows/check-rust.yml @@ -1,4 +1,4 @@ -name: CI +name: Check Rust concurrency: group: ci-${{ github.ref }} diff --git a/.github/workflows/e2e-bittensor-tests.yml b/.github/workflows/e2e-bittensor-tests.yml new file mode 100644 index 000000000..36cff06f9 --- /dev/null +++ b/.github/workflows/e2e-bittensor-tests.yml @@ -0,0 +1,81 @@ +name: E2E Bittensor Tests + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +on: + ## Run automatically for all PRs against main, regardless of what the changes are + ## to be safe and so we can more easily force re-run the CI when github is being + ## weird by using a blank commit + push: + branches: [main, development, staging] + + ## + # Run automatically for PRs against default/main branch if Rust files change + pull_request: + branches: [main, development, staging] + + ## Allow running workflow manually from the Actions tab + workflow_dispatch: + inputs: + verbose: + description: "Output more information when triggered manually" + required: false + default: "" + +env: + CARGO_TERM_COLOR: always + VERBOSE: ${{ github.events.input.verbose }} + +jobs: + # runs cargo fmt + e2e-bittensor-tests: + name: e2e bittensor tests + runs-on: SubtensorCI + strategy: + matrix: + rust-branch: + - nightly-2024-03-05 + rust-target: + - x86_64-unknown-linux-gnu + # - x86_64-apple-darwin + os: + - ubuntu-latest + # - macos-latest + include: + - os: ubuntu-latest + # - os: macos-latest + env: + RELEASE_NAME: development + # RUSTFLAGS: -A warnings + 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 build-essential + + - name: ls + run: ls + + - name: Install Rust ${{ matrix.rust-branch }} + uses: actions-rs/toolchain@v1.0.6 + with: + toolchain: ${{ matrix.rust-branch }} + components: rustfmt + profile: minimal + + - name: Setup bittensor repo + run: | + git clone https://github.com/opentensor/bittensor.git + cd bittensor + git checkout staging + python3 -m pip install -e bittensor/ + + - name: Run E2E tests + run: LOCALNET_SH_PATH="../subtensor/scripts/localnet.sh" pytest tests/e2e_tests/ -s From 9c773151e64eeb60867035f7067f790156193698 Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 17 May 2024 17:43:10 +0400 Subject: [PATCH 2/3] chore: increase initial balances --- .github/workflows/e2e-bittensor-tests.yml | 24 +++++++++++------------ node/src/chain_spec.rs | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/e2e-bittensor-tests.yml b/.github/workflows/e2e-bittensor-tests.yml index 36cff06f9..bed4dcec2 100644 --- a/.github/workflows/e2e-bittensor-tests.yml +++ b/.github/workflows/e2e-bittensor-tests.yml @@ -29,9 +29,7 @@ env: VERBOSE: ${{ github.events.input.verbose }} jobs: - # runs cargo fmt - e2e-bittensor-tests: - name: e2e bittensor tests + run: runs-on: SubtensorCI strategy: matrix: @@ -48,7 +46,6 @@ jobs: # - os: macos-latest env: RELEASE_NAME: development - # RUSTFLAGS: -A warnings RUSTV: ${{ matrix.rust-branch }} RUST_BACKTRACE: full RUST_BIN_DIR: target/${{ matrix.rust-target }} @@ -60,9 +57,6 @@ jobs: - name: Install dependencies run: sudo apt-get update && sudo apt-get install -y build-essential - - name: ls - run: ls - - name: Install Rust ${{ matrix.rust-branch }} uses: actions-rs/toolchain@v1.0.6 with: @@ -70,12 +64,18 @@ jobs: components: rustfmt profile: minimal + - name: Clone bittensor repo + run: git clone https://github.com/opentensor/bittensor.git + - name: Setup bittensor repo + working-directory: ${{ github.workspace }}/bittensor run: | - git clone https://github.com/opentensor/bittensor.git - cd bittensor git checkout staging - python3 -m pip install -e bittensor/ + python3 -m pip install -e . - - name: Run E2E tests - run: LOCALNET_SH_PATH="../subtensor/scripts/localnet.sh" pytest tests/e2e_tests/ -s + - name: Run tests + working-directory: ${{ github.workspace }}/bittensor + run: | + pwd + ls + LOCALNET_SH_PATH="../scripts/localnet.sh" pytest tests/e2e_tests/ -s diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 1ca9be776..3f5d99b44 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -371,27 +371,27 @@ fn localnet_genesis( let mut balances = vec![ ( get_account_id_from_seed::("Alice"), - 1000000000000u128, + 1000000000000000u128, ), ( get_account_id_from_seed::("Bob"), - 1000000000000u128, + 1000000000000000u128, ), ( get_account_id_from_seed::("Charlie"), - 1000000000000u128, + 1000000000000000u128, ), ( get_account_id_from_seed::("Dave"), - 2000000000u128, + 2000000000000u128, ), ( get_account_id_from_seed::("Eve"), - 2000000000u128, + 2000000000000u128, ), ( get_account_id_from_seed::("Ferdie"), - 2000000000u128, + 2000000000000u128, ), ]; From 14b1682dfd6b7cda89f80aab59a3a74a6c1e81a8 Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 17 May 2024 18:02:29 +0400 Subject: [PATCH 3/3] fix: concurrency groups --- .github/workflows/check-rust.yml | 2 +- .github/workflows/e2e-bittensor-tests.yml | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-rust.yml b/.github/workflows/check-rust.yml index fee14aa55..f7478028a 100644 --- a/.github/workflows/check-rust.yml +++ b/.github/workflows/check-rust.yml @@ -1,7 +1,7 @@ name: Check Rust concurrency: - group: ci-${{ github.ref }} + group: check-rust-${{ github.ref }} cancel-in-progress: true on: diff --git a/.github/workflows/e2e-bittensor-tests.yml b/.github/workflows/e2e-bittensor-tests.yml index bed4dcec2..c767f58d2 100644 --- a/.github/workflows/e2e-bittensor-tests.yml +++ b/.github/workflows/e2e-bittensor-tests.yml @@ -1,7 +1,7 @@ name: E2E Bittensor Tests concurrency: - group: ci-${{ github.ref }} + group: e2e-bittensor-${{ github.ref }} cancel-in-progress: true on: @@ -55,7 +55,9 @@ jobs: uses: actions/checkout@v2 - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y build-essential + 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/toolchain@v1.0.6 @@ -70,8 +72,9 @@ jobs: - name: Setup bittensor repo working-directory: ${{ github.workspace }}/bittensor run: | - git checkout staging + git checkout tests/e2e-tests-staging python3 -m pip install -e . + python3 -m pip install torch - name: Run tests working-directory: ${{ github.workspace }}/bittensor