nathycodes's picture
Deploy Tech Presenter Coach
ec17af3
Raw History Blame Contribute Delete
2.65 kB
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: "20"
PYTHON_VERSION: "3.11"
jobs:
web:
name: Web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: package-lock.json
- run: npm ci
- run: npm --workspace apps/web run lint
- run: npm --workspace apps/web exec tsc -- --noEmit
- run: npm --workspace apps/web test -- --run
- run: npm --workspace apps/web run build
env:
NEXT_TELEMETRY_DISABLED: 1
shared:
name: Shared
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: package-lock.json
- run: npm ci
- run: npm --workspace packages/shared exec tsc -- --noEmit
api:
name: API
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: video
POSTGRES_PASSWORD: video
POSTGRES_DB: video
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U video -d video"
--health-interval 5s
--health-timeout 3s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 5
defaults:
run:
working-directory: apps/api
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: apps/api/requirements-dev.txt
- run: python -m pip install --upgrade pip
- run: pip install -r requirements-dev.txt
- run: ruff check .
- run: mypy src/app --ignore-missing-imports --no-error-summary
- run: PYTHONPATH=src pytest -q --cov=app --cov-report=term-missing
env:
DATABASE_URL: sqlite:///./ci_test.db
JWT_SECRET: ci-test-secret
ENVIRONMENT: test
CORS_ORIGINS: http://localhost:3000
docker:
name: Docker Build
runs-on: ubuntu-latest
needs: [web, shared, api]
steps:
- uses: actions/checkout@v4
- run: docker compose build