From 1505949218d9c22d65c674d2313b9b9818f6566a Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 25 Aug 2025 12:59:40 -0700 Subject: [PATCH 1/5] split test cases to each matrix item --- .github/workflows/e2e-subtensor-tests.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/e2e-subtensor-tests.yaml b/.github/workflows/e2e-subtensor-tests.yaml index 265b358a84..e79e46e167 100644 --- a/.github/workflows/e2e-subtensor-tests.yaml +++ b/.github/workflows/e2e-subtensor-tests.yaml @@ -33,10 +33,24 @@ jobs: - name: Check-out repository under $GITHUB_WORKSPACE uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install deps for collection + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + - 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(. != ""))') + test_files=$(pytest -q --collect-only tests/e2e_tests \ + | sed -n '/^e2e_tests\//p' \ + | sed 's|^|tests/|' \ + | jq -R -s -c 'split("\n") | map(select(. != ""))') # keep it here for future debug # test_files=$(find tests/e2e_tests -type f -name "test*.py" | grep -E 'test_(hotkeys|staking)\.py$' | jq -R -s -c 'split("\n") | map(select(. != ""))') echo "Found test files: $test_files" From 74bc8a229625ccd90eeaae6060a07c4797920b81 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 25 Aug 2025 13:07:57 -0700 Subject: [PATCH 2/5] quote matrix test-file in pytest command --- .github/workflows/e2e-subtensor-tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-subtensor-tests.yaml b/.github/workflows/e2e-subtensor-tests.yaml index e79e46e167..4ac9db11ed 100644 --- a/.github/workflows/e2e-subtensor-tests.yaml +++ b/.github/workflows/e2e-subtensor-tests.yaml @@ -59,6 +59,7 @@ jobs: # Pull docker image pull-docker-image: + needs: find-tests runs-on: ubuntu-latest outputs: image-name: ${{ steps.set-image.outputs.image }} @@ -168,7 +169,7 @@ jobs: run: | for i in 1 2 3; do echo "::group::๐Ÿ” Test attempt $i" - if uv run pytest ${{ matrix.test-file }} -s; then + if uv run pytest "${{ matrix.test-file }}" -s; then echo "โœ… Tests passed on attempt $i" echo "::endgroup::" exit 0 From baf62396574a4d6b86873e8a4d42de8906901dd5 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 25 Aug 2025 13:27:04 -0700 Subject: [PATCH 3/5] try apply labels and increase `max-parallel` --- .github/workflows/e2e-subtensor-tests.yaml | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/e2e-subtensor-tests.yaml b/.github/workflows/e2e-subtensor-tests.yaml index 4ac9db11ed..692e91552d 100644 --- a/.github/workflows/e2e-subtensor-tests.yaml +++ b/.github/workflows/e2e-subtensor-tests.yaml @@ -45,17 +45,21 @@ jobs: - name: Find test files id: get-tests + shell: bash run: | - test_files=$(find tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))') - test_files=$(pytest -q --collect-only tests/e2e_tests \ + set -euo pipefail + test_matrix=$( + pytest -q --collect-only tests/e2e_tests \ | sed -n '/^e2e_tests\//p' \ | sed 's|^|tests/|' \ - | jq -R -s -c 'split("\n") | map(select(. != ""))') - # keep it here for future debug - # test_files=$(find tests/e2e_tests -type f -name "test*.py" | grep -E 'test_(hotkeys|staking)\.py$' | jq -R -s -c 'split("\n") | map(select(. != ""))') - echo "Found test files: $test_files" - echo "test-files=$test_files" >> "$GITHUB_OUTPUT" - shell: bash + | jq -R -s -c ' + split("\n") + | map(select(. != "")) + | map({nodeid: ., label: (sub("^tests/e2e_tests/"; ""))}) + ' + ) + echo "Found tests: $test_matrix" + echo "test-files=$test_matrix" >> "$GITHUB_OUTPUT" # Pull docker image pull-docker-image: @@ -126,7 +130,7 @@ jobs: # Job to run tests in parallel run-fast-blocks-e2e-test: - name: "FB: ${{ matrix.test-file }} / Python ${{ matrix.python-version }}" + name: "FB: ${{ matrix.label }} / Python ${{ matrix.python-version }}" # โ† ะฑั‹ะปะพ matrix.test-file needs: - find-tests - pull-docker-image @@ -134,11 +138,11 @@ jobs: timeout-minutes: 45 strategy: fail-fast: false # Allow other matrix jobs to run even if this job fails - max-parallel: 32 # Set the maximum number of parallel jobs (same as we have cores in ubuntu-latest runner) + max-parallel: 64 # Set the maximum number of parallel jobs (same as we have cores in ubuntu-latest runner) matrix: os: - ubuntu-latest - test-file: ${{ fromJson(needs.find-tests.outputs.test-files) }} + include: ${{ fromJson(needs.find-tests.outputs.test-files) }} python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Check-out repository @@ -169,7 +173,7 @@ jobs: run: | for i in 1 2 3; do echo "::group::๐Ÿ” Test attempt $i" - if uv run pytest "${{ matrix.test-file }}" -s; then + if uv run pytest "${{ matrix.nodeid }}" -s; then echo "โœ… Tests passed on attempt $i" echo "::endgroup::" exit 0 From 21efc5be1ba244f127c480f5898208e6551280d5 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 25 Aug 2025 13:40:46 -0700 Subject: [PATCH 4/5] include -> test + refer --- .github/workflows/e2e-subtensor-tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e-subtensor-tests.yaml b/.github/workflows/e2e-subtensor-tests.yaml index 692e91552d..859b313484 100644 --- a/.github/workflows/e2e-subtensor-tests.yaml +++ b/.github/workflows/e2e-subtensor-tests.yaml @@ -130,7 +130,7 @@ jobs: # Job to run tests in parallel run-fast-blocks-e2e-test: - name: "FB: ${{ matrix.label }} / Python ${{ matrix.python-version }}" # โ† ะฑั‹ะปะพ matrix.test-file + name: "FB: ${{ matrix.test.label }} / Python ${{ matrix.python-version }}" needs: - find-tests - pull-docker-image @@ -142,7 +142,7 @@ jobs: matrix: os: - ubuntu-latest - include: ${{ fromJson(needs.find-tests.outputs.test-files) }} + test: ${{ fromJson(needs.find-tests.outputs.test-files) }} python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Check-out repository @@ -173,7 +173,7 @@ jobs: run: | for i in 1 2 3; do echo "::group::๐Ÿ” Test attempt $i" - if uv run pytest "${{ matrix.nodeid }}" -s; then + if uv run pytest "${{ matrix.test.nodeid }}" -s; then echo "โœ… Tests passed on attempt $i" echo "::endgroup::" exit 0 From fc93bbca4702a100ef92237b476f92c771b26a07 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 25 Aug 2025 13:46:42 -0700 Subject: [PATCH 5/5] make test name shorter --- .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 859b313484..d56e9a726d 100644 --- a/.github/workflows/e2e-subtensor-tests.yaml +++ b/.github/workflows/e2e-subtensor-tests.yaml @@ -130,7 +130,7 @@ jobs: # Job to run tests in parallel run-fast-blocks-e2e-test: - name: "FB: ${{ matrix.test.label }} / Python ${{ matrix.python-version }}" + name: "${{ matrix.test.label }} / Py ${{ matrix.python-version }}" needs: - find-tests - pull-docker-image