110 lines
2.4 KiB
YAML
110 lines
2.4 KiB
YAML
name: Continuous Integration
|
|
|
|
on:
|
|
push:
|
|
branches: [ "master" ]
|
|
pull_request:
|
|
branches: [ "master" ]
|
|
|
|
jobs:
|
|
backend-tests:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
enable-cache: true
|
|
version: "latest"
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Run Pytest
|
|
run: |
|
|
cd backend
|
|
uv sync --dev
|
|
uv run pytest
|
|
env:
|
|
DATABASE_URL: "sqlite:///:memory:"
|
|
|
|
frontend-check:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: 'npm'
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
cd frontend
|
|
npm install
|
|
|
|
- name: Svelte Check & Lint
|
|
run: |
|
|
cd frontend
|
|
npx svelte-kit sync
|
|
npm run check
|
|
|
|
e2e-tests:
|
|
runs-on: ubuntu-latest
|
|
needs: [backend-tests, frontend-check]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
enable-cache: true
|
|
version: "latest"
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: 'npm'
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install Frontend Dependencies & Playwright
|
|
run: |
|
|
cd frontend
|
|
npm ci
|
|
npx playwright install --with-deps chromium
|
|
|
|
- name: Start Backend Test Server
|
|
run: |
|
|
cd backend
|
|
uv sync --dev
|
|
DATABASE_URL="sqlite:///test.db" TAPEHOARD_TEST_MODE="true" uv run alembic upgrade head
|
|
DATABASE_URL="sqlite:///test.db" TAPEHOARD_TEST_MODE="true" uv run uvicorn app.main:app --host 0.0.0.0 --port 8001 &
|
|
sleep 5 # Wait for server to start
|
|
|
|
- name: Run Playwright Tests
|
|
run: |
|
|
cd frontend
|
|
npx playwright test
|
|
|
|
- name: Upload Playwright Report
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-report
|
|
path: frontend/playwright-report/
|
|
retention-days: 14
|