@@ -5,18 +5,13 @@ concurrency:
5
5
cancel-in-progress : true
6
6
7
7
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
11
8
push :
12
9
branches : [main, development, staging]
13
10
14
- # #
15
- # Run automatically for PRs against default/main branch if Rust files change
16
11
pull_request :
17
12
branches : [main, development, staging]
13
+ types : [ opened, synchronize, reopened, ready_for_review ]
18
14
19
- # # Allow running workflow manually from the Actions tab
20
15
workflow_dispatch :
21
16
inputs :
22
17
verbose :
26
21
27
22
env :
28
23
CARGO_TERM_COLOR : always
29
- VERBOSE : ${{ github.events.input .verbose }}
24
+ VERBOSE : ${{ github.event.inputs .verbose }}
30
25
26
+ # job to run tests in parallel
31
27
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
32
46
run :
47
+ needs : find-tests
33
48
runs-on : SubtensorCI
34
49
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
35
52
matrix :
36
53
rust-branch :
37
54
- nightly-2024-03-05
38
55
rust-target :
39
56
- x86_64-unknown-linux-gnu
40
- # - x86_64-apple-darwin
41
57
os :
42
58
- 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) }}
47
60
env :
48
61
RELEASE_NAME : development
49
62
RUSTV : ${{ matrix.rust-branch }}
81
94
- name : Run tests
82
95
run : |
83
96
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