From b8e6499ebf1da59d8b507cf11b32e86782853fa5 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Wed, 24 Jul 2024 12:28:28 -0700 Subject: [PATCH 1/2] Init commit: Testing directory parallelization --- .github/workflows/e2e-subtensor-tests.yaml | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/e2e-subtensor-tests.yaml b/.github/workflows/e2e-subtensor-tests.yaml index 0bc467a94d..1bb2cea762 100644 --- a/.github/workflows/e2e-subtensor-tests.yaml +++ b/.github/workflows/e2e-subtensor-tests.yaml @@ -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: @@ -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 @@ -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 }} @@ -92,14 +92,17 @@ jobs: working-directory: ${{ github.workspace }}/subtensor run: git checkout testnet + - name: List tests + run: ls -l ${{ matrix.test-subfolder }} + - 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 + 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 From 08e838a1769a685f06d4fd7942c0cdb967f37e4f Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Wed, 21 Aug 2024 11:12:10 -0700 Subject: [PATCH 2/2] Test commit --- .github/workflows/e2e-subtensor-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-subtensor-tests.yaml b/.github/workflows/e2e-subtensor-tests.yaml index 1bb2cea762..1bb95d1abd 100644 --- a/.github/workflows/e2e-subtensor-tests.yaml +++ b/.github/workflows/e2e-subtensor-tests.yaml @@ -95,7 +95,7 @@ jobs: - name: List tests run: ls -l ${{ matrix.test-subfolder }} - - name: Run tests + - name: Run e2e tests run: | python3 -m pip install -e .[dev] pytest LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" pytest ${{ matrix.test-subfolder }} -s