Files
routstr-core/.github/workflows/test.yml

129 lines
3.1 KiB
YAML

name: Run Tests
on:
push:
branches: ["*"] # Run on all branches
pull_request:
branches: ["*"] # Run on PRs to all branches
jobs:
backend-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.14"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: |
uv sync --python ${{ matrix.python-version }} --dev
- name: Run linting with ruff
run: |
uv run --python ${{ matrix.python-version }} ruff check .
- name: Run type checking with mypy
run: |
uv run --python ${{ matrix.python-version }} mypy .
- name: Run tests with pytest
env:
UPSTREAM_BASE_URL: "http://test"
UPSTREAM_API_KEY: "test"
run: |
uv run --python ${{ matrix.python-version }} pytest --verbose --tb=short
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.python-version }}
path: |
pytest.xml
.coverage
retention-days: 30
postgres-compat:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: routstr
POSTGRES_PASSWORD: routstr
POSTGRES_DB: routstr
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --python 3.12 --dev
- name: Run PostgreSQL compatibility tests
env:
UPSTREAM_BASE_URL: "http://test"
UPSTREAM_API_KEY: "test"
ROUTSTR_TEST_POSTGRES_URL: "postgresql+asyncpg://routstr:routstr@127.0.0.1:5432/routstr"
run: |
uv run --python 3.12 pytest tests/integration/test_postgres_compatibility.py \
--verbose --tb=short
ui-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: ui/pnpm-lock.yaml
- name: Install UI dependencies
working-directory: ./ui
run: pnpm install --frozen-lockfile
- name: Run UI format check
working-directory: ./ui
run: pnpm run format-check
- name: Run UI linting
working-directory: ./ui
run: pnpm run lint
- name: Run UI build
working-directory: ./ui
run: pnpm run build