-
Notifications
You must be signed in to change notification settings - Fork 127
129 lines (109 loc) · 4.12 KB
/
Copy pathci.yml
File metadata and controls
129 lines (109 loc) · 4.12 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
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: "15 1 * * 1"
workflow_dispatch:
permissions:
contents: read
jobs:
# ──────────────────────────────────────────────
# Quality gates (run in parallel)
# ──────────────────────────────────────────────
test:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Setup dependencies
run: make setup
env:
UV_PYTHON: ${{ matrix.python-version }}
- name: Run tests
run: make test-coverage
env:
UV_PYTHON: ${{ matrix.python-version }}
# Consumed by the weekly coverage report, which reads the artifact from
# the newest successful run on main. Name is per-matrix-version because
# upload-artifact@v4 requires unique names within a run.
- name: Upload coverage report
uses: actions/upload-artifact@v7
if: always()
with:
name: coverage-${{ matrix.python-version }}
path: coverage.xml
if-no-files-found: error
e2e:
if: github.event_name != 'schedule' && github.repository == 'runpod/runpod-python'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install dependencies
run: |
uv venv
source .venv/bin/activate
uv pip install -e ".[test]" --quiet || uv pip install -e .
uv pip install runpod-flash pytest pytest-asyncio pytest-timeout pytest-rerunfailures httpx
uv pip install -e . --reinstall --no-deps
python -c "import runpod; print(f'runpod: {runpod.__version__} from {runpod.__file__}')"
- name: Run e2e tests
run: |
source .venv/bin/activate
pytest tests/e2e/ -v -p no:xdist --timeout=600 --reruns 1 --reruns-delay 5 --log-cli-level=INFO -o "addopts="
env:
RUNPOD_API_KEY: ${{ secrets.RUNPOD_API_KEY }}
RUNPOD_SDK_GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
codeql:
if: github.event_name == 'schedule' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: actions/checkout@v7
- name: Initialize CodeQL
uses: github/codeql-action/init@v4.38.1
with:
languages: python
queries: security-extended,security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v4.38.1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4.38.1
with:
category: "/language:python"
# ──────────────────────────────────────────────
# Validation gate
# ──────────────────────────────────────────────
validation:
runs-on: ubuntu-latest
needs: [test, e2e, codeql]
if: always()
steps:
- name: Check all jobs succeeded
run: |
results=("${{ needs.test.result }}" "${{ needs.e2e.result }}" "${{ needs.codeql.result }}")
for result in "${results[@]}"; do
if [[ "$result" != "success" && "$result" != "skipped" ]]; then
echo "One or more quality checks failed (got: $result)"
exit 1
fi
done