Files
2026-04-10 12:03:31 +02:00

159 lines
3.6 KiB
YAML

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
backend-tests:
name: Backend Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_USER: primora_test
POSTGRES_PASSWORD: test
POSTGRES_DB: primora_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26'
cache-dependency-path: apps/backend/go.sum
- name: Run backend tests
working-directory: apps/backend
env:
DATABASE_URL: postgres://primora_test:test@localhost:5432/primora_test?sslmode=disable
run: go test -v ./...
frontend-tests:
name: Frontend Tests
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'
- name: Install dependencies
run: npm ci
- name: Run frontend tests
run: npm run test --workspace @primora/frontend
- name: TypeScript check
run: npm run typecheck:frontend
build:
name: Build All Services
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'
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26'
cache-dependency-path: apps/backend/go.sum
- name: Install dependencies
run: npm ci
- name: Build frontend
run: npm run build --workspace @primora/frontend
- name: Build auth
run: npm run build --workspace @primora/auth
- name: Build backend
working-directory: apps/backend
run: go build -v ./cmd/server
docker-build:
name: Docker Build Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build backend image
uses: docker/build-push-action@v6
with:
context: .
file: apps/backend/Dockerfile
push: false
tags: primora-backend:test
- name: Build auth image
uses: docker/build-push-action@v6
with:
context: .
file: apps/auth/Dockerfile
push: false
tags: primora-auth:test
- name: Build frontend image
uses: docker/build-push-action@v6
with:
context: .
file: apps/frontend/Dockerfile
push: false
tags: primora-frontend:test
lint:
name: Lint
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'
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26'
cache-dependency-path: apps/backend/go.sum
- name: Install dependencies
run: npm ci
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
working-directory: apps/backend