Skip to content

Local venv

Local venv #4105

Workflow file for this run

name: Playwright CI Smoke
on:
push:
branches: ["main"]
paths:
- "mcpgateway/**"
- "tests/playwright/**"
- "pyproject.toml"
- ".github/workflows/playwright.yml"
pull_request:
types: [opened, synchronize, ready_for_review]
branches: ["main"]
paths:
- "mcpgateway/**"
- "tests/playwright/**"
- "pyproject.toml"
- ".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: 40
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
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@d0d8abe699bfb85fec6de9f7adb5ae17292296ff # v6
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/