-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (73 loc) · 2.43 KB
/
e2e-smoke.yml
File metadata and controls
87 lines (73 loc) · 2.43 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
# E2E Smoke Test Workflow for BasicChat
#
# This workflow runs a lightweight Playwright smoke test to verify the app loads in CI.
# It runs as a separate job for fast feedback and can be used as a required check.
#
# To view the report, download the artifact or run `npx playwright show-report` locally.
name: E2E Smoke Test
on:
push:
branches: [main, develop, feature/*]
pull_request:
branches: [main, develop, feature/*]
jobs:
smoke-test:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
redis:
image: redis
ports: [6379:6379]
env:
E2E_HOST: 0.0.0.0
E2E_PORT: 8501
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Install Node dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Fail if OPENAI_API_KEY is not set
run: |
if [ -z "$OPENAI_API_KEY" ]; then
echo "::error::OPENAI_API_KEY is not set. Failing early." >&2
exit 1
fi
- name: Start Streamlit app (background)
run: streamlit run app.py --server.port 8501 --server.headless true --server.address 0.0.0.0 &
- name: Wait for Streamlit to be ready
run: |
for i in {1..60}; do
if curl -sSf http://0.0.0.0:8501 | grep -q "BasicChat"; then
echo 'Streamlit is up!'; break
fi
sleep 1
done
- name: Run Playwright smoke test
run: npx playwright test tests/e2e/specs/smoke.spec.ts --project=chromium --reporter=dot,html --output=playwright-report
- name: Upload Playwright HTML report
uses: actions/upload-artifact@v4
with:
name: playwright-smoke-report
path: playwright-report
retention-days: 7
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-