Skip to content

UV

UV #4

# WARNING: This file is used by multiple workflows. Please modify with caution. Any changes here may affect multiple

Check failure on line 1 in .github/workflows/_run-e2e-single.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/_run-e2e-single.yaml

Invalid workflow file

(Line: 53, Col: 15): Expected format {org}/{repo}[/path]@ref. Actual 'astral-sh/setup-uv'
# 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@v6
with:
ref: ${{ inputs.ref != '' && inputs.ref || github.ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv
with:
enable-cache: false
- name: Cache uv and venv
uses: actions/cache@v5
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@v8
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