88 lines
2.0 KiB
YAML
88 lines
2.0 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'ci/**'
|
|
- develop
|
|
pull_request:
|
|
branches:
|
|
- develop
|
|
- main
|
|
|
|
jobs:
|
|
backend:
|
|
name: Backend Tests
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
env:
|
|
POSTGRES_USER: test
|
|
POSTGRES_PASSWORD: test
|
|
POSTGRES_DB: gartenmanager_test
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 5432:5432
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
cache: pip
|
|
cache-dependency-path: |
|
|
backend/requirements.txt
|
|
backend/requirements-test.txt
|
|
|
|
- name: Install dependencies
|
|
run: pip install -r backend/requirements.txt -r backend/requirements-test.txt
|
|
|
|
- name: Run tests
|
|
working-directory: backend
|
|
env:
|
|
DATABASE_URL: postgresql+asyncpg://test:test@localhost:5432/gartenmanager_test
|
|
SECRET_KEY: ci-test-secret-key-min-32-characters
|
|
run: pytest tests/ -v --cov=app --cov-report=xml --cov-report=term-missing
|
|
|
|
- name: Upload coverage
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: backend-coverage
|
|
path: backend/coverage.xml
|
|
|
|
frontend:
|
|
name: Frontend Tests
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: npm
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install dependencies
|
|
working-directory: frontend
|
|
run: npm ci
|
|
|
|
- name: Lint
|
|
working-directory: frontend
|
|
run: npm run lint
|
|
|
|
- name: Unit tests
|
|
working-directory: frontend
|
|
run: npm run test
|
|
|
|
- name: Build check
|
|
working-directory: frontend
|
|
run: npm run build
|