-
Notifications
You must be signed in to change notification settings - Fork 726
145 lines (126 loc) · 4.72 KB
/
Copy pathplaywright-smoke.yml
File metadata and controls
145 lines (126 loc) · 4.72 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
name: Playwright Smoke
on:
pull_request:
types: [opened, synchronize, ready_for_review]
branches: ["main"]
paths:
- "mcpgateway/**"
- "tests/playwright/**"
- "pyproject.toml"
- "package.json"
- "package-lock.json"
- "tailwind.config.js"
- "vite.config.js"
- "postcss.config.js"
- ".github/workflows/playwright.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
playwright-ci-smoke:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
name: playwright-ci-smoke
runs-on: ubuntu-24.04
timeout-minutes: 15
env:
PYTHONUNBUFFERED: "1"
PIP_DISABLE_PIP_VERSION_CHECK: "1"
TEST_BASE_URL: http://127.0.0.1:4444
GUNICORN_WORKERS: "1"
MCPGATEWAY_UI_ENABLED: "true"
MCPGATEWAY_ADMIN_API_ENABLED: "true"
SECURE_COOKIES: "false"
PLAYWRIGHT_INSTALL_FLAGS: --with-deps
UV_CACHE_DIR: /tmp/uv-cache
# Disable forced password-change on bootstrap so Playwright tests can
# access /admin/ without being redirected to /admin/change-password-required
ADMIN_REQUIRE_PASSWORD_CHANGE_ON_BOOTSTRAP: "false"
PASSWORD_CHANGE_ENFORCEMENT_ENABLED: "false"
# Disable rate limiting to prevent account lockouts during test runs
RATE_LIMITING_ENABLED: "false"
RATE_LIMIT_LOCKOUT_ENABLED: "false"
# Override .env.example placeholders — env vars take precedence over .env in pydantic-settings
JWT_SECRET_KEY: "ci-playwright-smoke-jwt-secret-not-for-production-use" # pragma: allowlist secret
AUTH_ENCRYPTION_SECRET: "ci-playwright-smoke-auth-enc-secret-not-for-production" # pragma: allowlist secret
steps:
- name: ⬇️ Checkout source
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
fetch-depth: 1
- name: 🐍 Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.12"
- name: ⚡ Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
version: "0.9.2"
python-version: "3.12"
- name: 🟢 Install Node.js 22
run: |
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" \
| sudo tee /etc/apt/sources.list.d/nodesource.list > /dev/null
sudo apt-get update
sudo apt-get install -y nodejs
node --version
npm --version
- name: 🔧 Upgrade npm to minimum required version
run: sudo npm install -g npm@^11.10.0
- name: 📦 Install gateway dependencies
run: |
make venv install
- name: 🏗️ Build admin UI bundle
run: |
npm ci
npm run vite:build
- name: 🎭 Run make serve + CI smoke tests
shell: bash
run: |
set -euo pipefail
cleanup() {
status=$?
if [[ -f /tmp/mcpgateway-ci.pid ]] && kill -0 "$(cat /tmp/mcpgateway-ci.pid)" 2>/dev/null; then
kill "$(cat /tmp/mcpgateway-ci.pid)" || true
sleep 1
fi
if [[ $status -ne 0 ]]; then
echo "Gateway log tail (failure context):"
tail -n 250 /tmp/mcpgateway-ci.log || true
fi
}
trap cleanup EXIT
cp .env.example .env
make serve > /tmp/mcpgateway-ci.log 2>&1 &
echo $! > /tmp/mcpgateway-ci.pid
for _ in {1..120}; do
if curl -fsS "${TEST_BASE_URL}/health" >/dev/null; then
break
fi
if ! kill -0 "$(cat /tmp/mcpgateway-ci.pid)" 2>/dev/null; then
echo "Gateway exited during startup."
exit 1
fi
sleep 1
done
curl -fsS "${TEST_BASE_URL}/health" >/dev/null
make test-ui-ci-smoke
- name: 📦 Upload Playwright artifacts
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: playwright-ci-smoke-artifacts
if-no-files-found: ignore
retention-days: 7
path: |
/tmp/mcpgateway-ci.log
test-results/
tests/playwright/reports/