Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing e2e directory parallelization #2166

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .github/workflows/e2e-subtensor-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

pull_request:
branches: [main, development, staging]
types: [ opened, synchronize, reopened, ready_for_review ]
types: [opened, synchronize, reopened, ready_for_review]

workflow_dispatch:
inputs:
Expand All @@ -23,23 +23,22 @@ env:
CARGO_TERM_COLOR: always
VERBOSE: ${{ github.event.inputs.verbose }}

# job to run tests in parallel
jobs:
# Job to find all test files
# Job to find all test subfolders to run in parallel
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 }}
test-subfolders: ${{ steps.get-tests.outputs.test-subfolders }}
steps:
- name: Check-out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v2

- name: Find test files
- name: Find test subfolders
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"
test_dirs=$(find tests/e2e_tests -type f -name "test*.py" -exec dirname {} \; | sort | uniq | jq -R -s -c 'split("\n") | map(select(. != ""))')
echo "::set-output name=test-subfolders::$test_dirs"
shell: bash

# Job to run tests in parallel
Expand All @@ -57,7 +56,8 @@ jobs:
- x86_64-unknown-linux-gnu
os:
- ubuntu-latest
test-file: ${{ fromJson(needs.find-tests.outputs.test-files) }}
test-subfolder: ${{ fromJson(needs.find-tests.outputs.test-subfolders) }}
name: Runing tests in ${{ matrix.test-subfolder }}
env:
RELEASE_NAME: development
RUSTV: ${{ matrix.rust-branch }}
Expand Down Expand Up @@ -92,14 +92,17 @@ jobs:
working-directory: ${{ github.workspace }}/subtensor
run: git checkout testnet

- name: Run tests
- name: List tests
run: ls -l ${{ matrix.test-subfolder }}

- name: Run e2e tests
run: |
python3 -m pip install -e .[dev] pytest
LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" pytest ${{ matrix.test-file }} -s
LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" pytest ${{ matrix.test-subfolder }} -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
LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" pytest ${{ matrix.test-subfolder }} -s
Loading