-
Notifications
You must be signed in to change notification settings - Fork 8.9k
186 lines (158 loc) · 6.4 KB
/
smoke-tests.yml
File metadata and controls
186 lines (158 loc) · 6.4 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
name: Smoke Tests
on:
pull_request:
types: [opened, labeled, synchronize, reopened]
release:
types: [published]
workflow_dispatch:
inputs:
ref:
description: 'Git ref to checkout (branch, tag, or commit SHA)'
required: false
default: ''
type: string
jobs:
backend-smoke-tests:
if: contains(github.event.pull_request.labels.*.name, 'smoke-test') || github.event_name == 'release' || github.event_name == 'workflow_dispatch'
name: "Backend Smoke Tests"
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout PR
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.inputs.ref || github.ref }}
- name: Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
- name: Install backend dependencies
run: |
uv sync --dev
- name: Run backend smoke tests (critical tests only)
run: |
uv run pytest \
src/backend/tests/unit/test_database.py \
src/backend/tests/unit/test_login.py \
src/backend/tests/unit/api/v1/test_validate.py \
src/backend/tests/unit/test_endpoints.py \
src/backend/tests/unit/api/v1/test_flows.py \
src/backend/tests/unit/test_chat_endpoint.py \
src/backend/tests/unit/api/v1/test_api_key.py \
src/backend/tests/unit/api/v1/test_endpoints.py \
src/backend/tests/unit/components/languagemodels/test_openai_model.py \
src/backend/tests/unit/components/agents/test_agent_component.py \
src/backend/tests/unit/services/tracing/test_tracing_service.py \
-m 'not api_key_required' \
--tb=short \
-v
env:
LANGFLOW_SUPERUSER: admin
LANGFLOW_SUPERUSER_PASSWORD: 123456
lfx-smoke-tests:
# created a separate label for this since it's a different test suite for LFX components
if: contains(github.event.pull_request.labels.*.name, 'smoke-test') || github.event_name == 'release' || github.event_name == 'workflow_dispatch'
name: "LFX Smoke Tests"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout PR
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.inputs.ref || github.ref }}
- name: Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
- name: Install lfx dependencies (isolated)
run: |
cd src/lfx
uv sync --dev
- name: Run lfx smoke tests (critical tests only)
run: |
cd src/lfx
uv run pytest \
tests/unit/graph/test_graph.py \
tests/unit/custom/component/test_component_instance_attributes.py \
tests/unit/schema/test_schema_message.py \
-m 'not api_key_required' \
--tb=short \
--maxfail=5 \
-v
env:
LANGFLOW_SUPERUSER: admin
LANGFLOW_SUPERUSER_PASSWORD: 123456
frontend-smoke-tests:
if: contains(github.event.pull_request.labels.*.name, 'smoke-test') || github.event_name == 'release' || github.event_name == 'workflow_dispatch'
name: "Frontend Smoke Tests"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout PR
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.inputs.ref || github.ref }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
cache: "npm"
cache-dependency-path: src/frontend/package-lock.json
- name: Install frontend dependencies
run: |
cd src/frontend
npm ci
- name: Run frontend smoke tests (unit tests only)
run: |
cd src/frontend
CI=true npx jest --ci --watchAll=false --passWithNoTests
env:
NODE_ENV: test
comment-results:
if: always() && (contains(github.event.pull_request.labels.*.name, 'smoke-test') || github.event_name == 'release' || github.event_name == 'workflow_dispatch')
name: "Comment Results"
needs: [backend-smoke-tests, lfx-smoke-tests, frontend-smoke-tests]
runs-on: ubuntu-latest
steps:
- name: Comment on PR with results
uses: actions/github-script@v8
with:
script: |
const backendStatus = '${{ needs.backend-smoke-tests.result }}';
const lfxStatus = '${{ needs.lfx-smoke-tests.result }}';
const frontendStatus = '${{ needs.frontend-smoke-tests.result }}';
const overallSuccess = backendStatus === 'success' && lfxStatus === 'success' && frontendStatus === 'success';
const emoji = overallSuccess ? '✅' : '❌';
const status = overallSuccess ? 'passed' : 'failed';
const backendEmoji = backendStatus === 'success' ? '✅' : '❌';
const lfxEmoji = lfxStatus === 'success' ? '✅' : '❌';
const frontendEmoji = frontendStatus === 'success' ? '✅' : '❌';
const comment = `${emoji} **Smoke tests ${status}**
Critical functionality validated:
- ${backendEmoji} **Backend**: 11 essential test files (database, auth, API endpoints, flows, components)
- ${lfxEmoji} **LFX**: Graph tests (langflow execution) - runs in isolation
- ${frontendEmoji} **Frontend**: Unit tests only (components, utilities)
**Coverage**: Core functionality without external dependencies
View details in the [Actions tab](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).`;
// Only comment on PRs, not on releases or manual runs
if (context.payload.pull_request) {
await github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
} else {
console.log('Smoke test results:', comment);
}