-
Notifications
You must be signed in to change notification settings - Fork 99
205 lines (199 loc) · 7.13 KB
/
Copy pathgraphql_tests.yml
File metadata and controls
205 lines (199 loc) · 7.13 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: GraphQL test framework
on:
pull_request:
paths:
- "tests/**"
- "packages/api-cardano-db-hasura/schema.graphql"
- "packages/api-cardano-db-hasura/src/example_queries/**"
- ".github/workflows/graphql_tests.yml"
schedule:
# Nightly at 02:15 UTC — full functional + negative + schema check.
- cron: "15 2 * * *"
# Weekly on Sunday at 03:30 UTC — adds a perf smoke + baseline gate.
- cron: "30 3 * * 0"
workflow_dispatch:
inputs:
graphql_url:
description: "Override GRAPHQL_URL (default: from secrets or nightly endpoint)"
required: false
default: ""
run_perf:
description: "Also run Phase 2 perf smoke"
required: false
default: "false"
env:
PYTHON_VERSION: "3.12"
CARDANO_NETWORK: mainnet
jobs:
# --------------------------------------------------------------------------
# PR gate — fast path. Marker: pr. Runs only sanity + negative tests that
# don't require a live cardano-graphql endpoint (they'll be skipped unless
# GRAPHQL_URL is wired through secrets).
# --------------------------------------------------------------------------
pr-gate:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install deps
working-directory: tests
run: |
export PATH="$HOME/.local/bin:$PATH"
uv sync
- name: Collect-only (fail if structure broken)
working-directory: tests
run: |
export PATH="$HOME/.local/bin:$PATH"
uv run pytest --collect-only -q
- name: Run PR-gate suite (requires GRAPHQL_URL)
if: ${{ secrets.GRAPHQL_URL != '' }}
working-directory: tests
env:
CI: "true"
GRAPHQL_URL: ${{ secrets.GRAPHQL_URL }}
run: |
export PATH="$HOME/.local/bin:$PATH"
uv run python generate_report.py -- -m pr
- uses: actions/upload-artifact@v4
if: always()
with:
name: pr-gate-html-report
path: tests/reports/report.html
# --------------------------------------------------------------------------
# Nightly — full functional + negative + schema-snapshot drift check.
# --------------------------------------------------------------------------
nightly:
if: ${{ github.event_name == 'schedule' && github.event.schedule == '15 2 * * *' }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install deps
working-directory: tests
run: |
export PATH="$HOME/.local/bin:$PATH"
uv sync
- name: Run full suite
working-directory: tests
env:
CI: "true"
GRAPHQL_URL: ${{ secrets.GRAPHQL_URL_NIGHTLY }}
run: |
export PATH="$HOME/.local/bin:$PATH"
uv run python generate_report.py -- functional/ negative/ schema/ --tb=short
- uses: actions/upload-artifact@v4
if: always()
with:
name: nightly-html-report
path: tests/reports/report.html
# --------------------------------------------------------------------------
# Weekly — full suite + Phase 2 perf smoke + baseline gate.
# --------------------------------------------------------------------------
weekly:
if: ${{ github.event_name == 'schedule' && github.event.schedule == '30 3 * * 0' }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install deps
working-directory: tests
run: |
export PATH="$HOME/.local/bin:$PATH"
uv sync
- name: Run full functional suite
working-directory: tests
env:
CI: "true"
GRAPHQL_URL: ${{ secrets.GRAPHQL_URL_NIGHTLY }}
run: |
export PATH="$HOME/.local/bin:$PATH"
uv run pytest functional/ negative/ schema/ --tb=short
- name: Perf smoke (5 users / 120s / light mix)
working-directory: tests
env:
CI: "true"
GRAPHQL_URL: ${{ secrets.GRAPHQL_URL_NIGHTLY }}
run: |
export PATH="$HOME/.local/bin:$PATH"
uv run python performance/run_load.py \
--profile=smoke \
--load-profile=light \
--run-time=120s \
--csv-prefix=reports/perf-weekly
- name: Enforce perf baselines
working-directory: tests
run: |
export PATH="$HOME/.local/bin:$PATH"
uv run python performance/check_baselines.py \
reports/perf-weekly_stats.csv \
--ignore-aggregated
- uses: actions/upload-artifact@v4
if: always()
with:
name: weekly-reports
path: |
tests/reports/
# --------------------------------------------------------------------------
# Manual — honours workflow_dispatch inputs.
# --------------------------------------------------------------------------
manual:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install deps
working-directory: tests
run: |
export PATH="$HOME/.local/bin:$PATH"
uv sync
- name: Resolve GRAPHQL_URL
id: cfg
run: |
if [ -n "${{ github.event.inputs.graphql_url }}" ]; then
echo "url=${{ github.event.inputs.graphql_url }}" >> "$GITHUB_OUTPUT"
else
echo "url=${{ secrets.GRAPHQL_URL_NIGHTLY }}" >> "$GITHUB_OUTPUT"
fi
- name: Functional + negative + schema
working-directory: tests
env:
CI: "true"
GRAPHQL_URL: ${{ steps.cfg.outputs.url }}
run: |
export PATH="$HOME/.local/bin:$PATH"
uv run pytest functional/ negative/ schema/ --tb=short
- name: Perf smoke (optional)
if: ${{ github.event.inputs.run_perf == 'true' }}
working-directory: tests
env:
CI: "true"
GRAPHQL_URL: ${{ steps.cfg.outputs.url }}
run: |
export PATH="$HOME/.local/bin:$PATH"
uv run python performance/run_load.py \
--profile=smoke --load-profile=light --run-time=120s \
--csv-prefix=reports/perf-manual
uv run python performance/check_baselines.py \
reports/perf-manual_stats.csv --ignore-aggregated