12
12
branches : [master, development, staging]
13
13
types : [ opened, synchronize, reopened, ready_for_review ]
14
14
15
+ schedule :
16
+ - cron : ' 0 9 * * *' # Run every night at 2:00 PST
17
+
15
18
workflow_dispatch :
16
19
inputs :
17
20
verbose :
40
43
run : |
41
44
test_files=$(find tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
42
45
# keep it here for future debug
43
- # test_files=$(find tests/e2e_tests -type f -name "test*.py" | grep -E 'test_(incentive|commit_weights|set_weights )\.py$' | jq -R -s -c 'split("\n") | map(select(. != ""))')
46
+ # 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(. != ""))')
44
47
echo "test-files=$test_files" >> "$GITHUB_OUTPUT"
45
48
shell : bash
46
49
63
66
path : subtensor-localnet.tar
64
67
65
68
# Job to run tests in parallel
66
- run-e2e-test :
67
- name : ${{ matrix.test-file }} / Python ${{ matrix.python-version }}
69
+ run-fast-blocks- e2e-test :
70
+ name : " FB: ${{ matrix.test-file }} / Python ${{ matrix.python-version }}"
68
71
needs :
69
72
- find-tests
70
73
- pull-docker-image
@@ -107,7 +110,92 @@ jobs:
107
110
- name : Run tests with retry
108
111
run : |
109
112
set +e
110
- for i in 1 2; do
113
+ for i in 1 2 3; do
114
+ echo "🔁 Attempt $i: Running tests"
115
+ uv run pytest ${{ matrix.test-file }} -s
116
+ status=$?
117
+ if [ $status -eq 0 ]; then
118
+ echo "✅ Tests passed on attempt $i"
119
+ break
120
+ else
121
+ echo "❌ Tests failed on attempt $i"
122
+ if [ $i -eq 3 ]; then
123
+ echo "Tests failed after 3 attempts"
124
+ exit 1
125
+ fi
126
+ echo "Retrying..."
127
+ sleep 5
128
+ fi
129
+ done
130
+
131
+ # run non-fast-blocks only on Saturday and by cron schedule
132
+ check-if-saturday :
133
+ if : github.event_name == 'schedule'
134
+ runs-on : ubuntu-latest
135
+ outputs :
136
+ is-saturday : ${{ steps.check.outputs.is-saturday }}
137
+ steps :
138
+ - id : check
139
+ run : |
140
+ day=$(date -u +%u)
141
+ echo "Today is weekday $day"
142
+ if [ "$day" -ne 6 ]; then
143
+ echo "⏭️ Skipping: not Saturday"
144
+ echo "is-saturday=false" >> "$GITHUB_OUTPUT"
145
+ exit 0
146
+ fi
147
+ echo "is-saturday=true"
148
+ echo "is-saturday=true" >> "$GITHUB_OUTPUT"
149
+
150
+
151
+ cron-run-non-fast-blocks-e2e-test :
152
+ if : github.event_name == 'schedule' && needs.check-if-saturday.outputs.is-saturday == 'true'
153
+ name : " NFB: ${{ matrix.test-file }} / Python ${{ matrix.python-version }}"
154
+ needs :
155
+ - check-if-saturday
156
+ - find-tests
157
+ - pull-docker-image
158
+ runs-on : ubuntu-latest
159
+ timeout-minutes : 1440
160
+
161
+ strategy :
162
+ fail-fast : false # Allow other matrix jobs to run even if this job fails
163
+ max-parallel : 32 # Set the maximum number of parallel jobs (same as we have cores in ubuntu-latest runner)
164
+ matrix :
165
+ os :
166
+ - ubuntu-latest
167
+ test-file : ${{ fromJson(needs.find-tests.outputs.test-files) }}
168
+ python-version : ["3.9", "3.10", "3.11", "3.12", "3.13"]
169
+
170
+ steps :
171
+ - name : Check-out repository
172
+ uses : actions/checkout@v4
173
+
174
+ - name : Set up Python ${{ matrix.python-version }}
175
+ uses : actions/setup-python@v5
176
+ with :
177
+ python-version : ${{ matrix.python-version }}
178
+
179
+ - name : Install uv
180
+ uses : astral-sh/setup-uv@v4
181
+
182
+ - name : install dependencies
183
+ run : uv sync --extra dev --dev
184
+
185
+ - name : Download Cached Docker Image
186
+ uses : actions/download-artifact@v4
187
+ with :
188
+ name : subtensor-localnet
189
+
190
+ - name : Load Docker Image
191
+ run : docker load -i subtensor-localnet.tar
192
+
193
+ - name : Run patched E2E tests
194
+ env :
195
+ FAST_BLOCKS : " 0"
196
+ run : |
197
+ set +e
198
+ for i in 1 2 3; do
111
199
echo "🔁 Attempt $i: Running tests"
112
200
uv run pytest ${{ matrix.test-file }} -s
113
201
status=$?
@@ -116,8 +204,8 @@ jobs:
116
204
break
117
205
else
118
206
echo "❌ Tests failed on attempt $i"
119
- if [ $i -eq 2 ]; then
120
- echo "Tests failed after 2 attempts"
207
+ if [ $i -eq 3 ]; then
208
+ echo "Tests failed after 3 attempts"
121
209
exit 1
122
210
fi
123
211
echo "Retrying..."
0 commit comments