-
Notifications
You must be signed in to change notification settings - Fork 454
Expand file tree
/
Copy pathnightly-e2e-tests-subtensor-main.yml
More file actions
178 lines (157 loc) · 5.72 KB
/
nightly-e2e-tests-subtensor-main.yml
File metadata and controls
178 lines (157 loc) · 5.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Nightly E2E Subtensor tests
permissions:
contents: read
packages: write
concurrency:
group: e2e-subtensor-${{ github.ref }}
cancel-in-progress: true
on:
schedule:
- cron: '0 9 * * *' # Run every night at 2:00 PST
workflow_dispatch:
inputs:
verbose:
description: "Output more information when triggered manually"
required: false
default: ""
env:
CARGO_TERM_COLOR: always
VERBOSE: ${{ github.event.inputs.verbose }}
# job to run tests in parallel
jobs:
# Looking for e2e tests
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 }}
steps:
- name: Check-out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: false
cache-dependency-glob: '**/pyproject.toml'
ignore-nothing-to-cache: true
- name: Cache uv and venv
uses: actions/cache@v4
with:
path: |
~/.cache/uv
.venv
key: uv-${{ runner.os }}-py3.10-${{ hashFiles('pyproject.toml') }}
restore-keys: uv-${{ runner.os }}-py3.10-
- name: Install dependencies (faster if cache hit)
run: uv sync --extra dev --dev
- name: Find test files
id: get-tests
shell: bash
run: |
set -euo pipefail
test_matrix=$(
uv run pytest -q --collect-only tests/e2e_tests \
| sed -n '/^e2e_tests\//p' \
| sed 's|^|tests/|' \
| 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"
# Read Python versions
read-python-versions:
runs-on: ubuntu-latest
outputs:
python-versions: ${{ steps.read-versions.outputs.versions }}
steps:
- uses: actions/checkout@v4
- id: read-versions
run: |
versions=$(cat .github/supported-python-versions.json)
echo "versions=$versions" >> $GITHUB_OUTPUT
# Pull docker images (devnet-ready and main)
pull-docker-images:
runs-on: ubuntu-latest
steps:
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- name: Pull Docker Image
run: |
docker pull ghcr.io/opentensor/subtensor-localnet:main
docker pull ghcr.io/opentensor/subtensor-localnet:devnet-ready
- name: List pulled images
run: docker images
- name: Save Docker Images to Cache
run: |
docker save -o subtensor-localnet-main.tar ghcr.io/opentensor/subtensor-localnet:main
docker save -o subtensor-localnet-devnet-ready.tar ghcr.io/opentensor/subtensor-localnet:devnet-ready
- name: Upload main Docker Image as Artifact
uses: actions/upload-artifact@v4
with:
name: subtensor-localnet-main
path: subtensor-localnet-main.tar
- name: Upload devnet-ready Docker Image as Artifact
uses: actions/upload-artifact@v4
with:
name: subtensor-localnet-devnet-ready
path: subtensor-localnet-devnet-ready.tar
# Daily run of fast-blocks tests from `bittensor:master` based on `subtensor:main docker` image
run-fast-blocks-e2e-test-master:
name: "master: ${{ matrix.label }}"
needs:
- find-tests
- pull-docker-images
- read-python-versions
strategy:
fail-fast: false
max-parallel: 64
matrix:
include: ${{ fromJson(needs.find-tests.outputs.test-files) }}
uses: ./.github/workflows/_run-e2e-single.yaml
with:
nodeid: ${{ matrix.nodeid }}
image-name: ghcr.io/opentensor/subtensor-localnet:main
python-versions: ${{ needs.read-python-versions.outputs.python-versions }}
ref: master
artifact-name: subtensor-localnet-main
secrets: inherit
# Daily run of fast-blocks tests from `bittensor:staging` based on `subtensor:devnet-ready` docker image
run-fast-blocks-e2e-test-staging:
name: "staging: ${{ matrix.label }}"
needs:
- find-tests
- pull-docker-images
- read-python-versions
strategy:
fail-fast: false
max-parallel: 64
matrix:
include: ${{ fromJson(needs.find-tests.outputs.test-files) }}
uses: ./.github/workflows/_run-e2e-single.yaml
with:
nodeid: ${{ matrix.nodeid }}
image-name: ghcr.io/opentensor/subtensor-localnet:devnet-ready
python-versions: ${{ needs.read-python-versions.outputs.python-versions }}
ref: staging
artifact-name: subtensor-localnet-devnet-ready
secrets: inherit
# Send centralized Discord failure notification
notify-on-failure:
needs:
- run-fast-blocks-e2e-test-master
- run-fast-blocks-e2e-test-staging
if: always() && (needs.run-fast-blocks-e2e-test-master.result == 'failure' || needs.run-fast-blocks-e2e-test-staging.result == 'failure')
runs-on: ubuntu-latest
steps:
- name: Send centralized Discord failure notification
run: |
curl -X POST -H "Content-Type: application/json" \
-d "{\"username\": \"SDK\", \"content\": \"❌ Nightly E2E tests failed. Check run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>\"}" \
"${{ secrets.NIGHTLY_WEBHOOK_URL }}"