Skip to content

Commit abaabd0

Browse files
committedJul 12, 2024
Updated e2e yaml file
1 parent e4e9caf commit abaabd0

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed
 

‎.github/workflows/e2e-subtensor-tests.yaml

+33-13
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@ concurrency:
55
cancel-in-progress: true
66

77
on:
8-
## Run automatically for all PRs against main, regardless of what the changes are
9-
## to be safe and so we can more easily force re-run the CI when github is being
10-
## weird by using a blank commit
118
push:
129
branches: [main, development, staging]
1310

14-
##
15-
# Run automatically for PRs against default/main branch if Rust files change
1611
pull_request:
1712
branches: [main, development, staging]
13+
types: [ opened, synchronize, reopened, ready_for_review ]
1814

19-
## Allow running workflow manually from the Actions tab
2015
workflow_dispatch:
2116
inputs:
2217
verbose:
@@ -26,24 +21,42 @@ on:
2621

2722
env:
2823
CARGO_TERM_COLOR: always
29-
VERBOSE: ${{ github.events.input.verbose }}
24+
VERBOSE: ${{ github.event.inputs.verbose }}
3025

26+
# job to run tests in parallel
3127
jobs:
28+
# Job to find all test files
29+
find-tests:
30+
runs-on: ubuntu-latest
31+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
32+
outputs:
33+
test-files: ${{ steps.get-tests.outputs.test-files }}
34+
steps:
35+
- name: Check-out repository under $GITHUB_WORKSPACE
36+
uses: actions/checkout@v2
37+
38+
- name: Find test files
39+
id: get-tests
40+
run: |
41+
test_files=$(find tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
42+
echo "::set-output name=test-files::$test_files"
43+
shell: bash
44+
45+
# Job to run tests in parallel
3246
run:
47+
needs: find-tests
3348
runs-on: SubtensorCI
3449
strategy:
50+
fail-fast: false # Allow other matrix jobs to run even if this job fails
51+
max-parallel: 8 # Set the maximum number of parallel jobs
3552
matrix:
3653
rust-branch:
3754
- nightly-2024-03-05
3855
rust-target:
3956
- x86_64-unknown-linux-gnu
40-
# - x86_64-apple-darwin
4157
os:
4258
- ubuntu-latest
43-
# - macos-latest
44-
include:
45-
- os: ubuntu-latest
46-
# - os: macos-latest
59+
test-file: ${{ fromJson(needs.find-tests.outputs.test-files) }}
4760
env:
4861
RELEASE_NAME: development
4962
RUSTV: ${{ matrix.rust-branch }}
@@ -81,4 +94,11 @@ jobs:
8194
- name: Run tests
8295
run: |
8396
python3 -m pip install -e .[dev] pytest
84-
LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" pytest tests/e2e_tests/ -s
97+
LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" pytest ${{ matrix.test-file }} -s
98+
99+
- name: Retry failed tests
100+
if: failure()
101+
run: |
102+
sleep 10
103+
python3 -m pip install -e .[dev] pytest
104+
LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" pytest ${{ matrix.test-file }} -s

0 commit comments

Comments
 (0)