-
Notifications
You must be signed in to change notification settings - Fork 453
102 lines (89 loc) · 2.86 KB
/
_run-e2e-single.yaml
File metadata and controls
102 lines (89 loc) · 2.86 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
# WARNING: This file is used by multiple workflows. Please modify with caution. Any changes here may affect multiple
# CI/CD pipelines.
name: Run Single E2E Test with multiple Python versions
on:
workflow_call:
inputs:
nodeid:
required: true
type: string
image-name:
required: true
type: string
python-versions:
required: true
type: string
description: JSON array of Python versions
ref:
required: false
type: string
description: Git ref to checkout
default: ""
artifact-name:
required: false
type: string
description: Docker image artifact name
default: "subtensor-localnet"
jobs:
run-e2e:
name: "${{ matrix.python-version }}"
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(inputs.python-versions) }}
steps:
- name: Check-out repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref != '' && inputs.ref || github.ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: false
- name: Cache uv and venv
uses: actions/cache@v4
with:
path: |
~/.cache/uv
.venv
key: |
uv-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
uv-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
uv-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-
- name: Install dependencies
run: uv sync --extra dev --dev
- name: Download Cached Docker Image
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact-name }}
- name: Load Docker Image
run: docker load -i ${{ inputs.artifact-name }}.tar
- name: Run test with retry
env:
PY_VERSION: ${{ matrix.python-version }}
LOCALNET_IMAGE_NAME: ${{ inputs.image-name }}
run: |
for i in 1 2 3; do
echo "::group::🔁 Test attempt $i"
if uv run pytest "${{ inputs.nodeid }}" -s; then
echo "✅ Tests passed on attempt $i"
echo "::endgroup::"
exit 0
else
echo "❌ Tests failed on attempt $i"
echo "::endgroup::"
if [ "$i" -lt 3 ]; then
echo "Retrying..."
sleep 15
fi
fi
done
echo "Tests failed after 3 attempts"
exit 1