Files
redefined-designs/.gitea/workflows/tests.yml
T
bermudalamb 2bff3a231f
SonarQube Analysis / sonarqube (pull_request) Successful in 4m43s
Tests / backend-unit (pull_request) Successful in 1m1s
Tests / backend-integration (pull_request) Successful in 1m32s
Tests / frontend-e2e (pull_request) Failing after 59s
ci: fix Postgres service port conflict in CI
2026-08-14 08:41:40 -05:00

160 lines
4.1 KiB
YAML

name: Tests
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
backend-unit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install deps
run: npm install
working-directory: backend
- name: Run unit tests
id: unit
continue-on-error: true
run: npm run test:unit:json
working-directory: backend
- name: Summarize
if: always()
run: node scripts/summarize-jest.js backend/unit-results.json "Backend Unit Test"
- name: Fail job if tests failed
if: steps.unit.outcome == 'failure'
run: exit 1
backend-integration:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: redefined_test
POSTGRES_PASSWORD: redefined_test
POSTGRES_DB: redefined_test
options: >-
--health-cmd "pg_isready -U redefined_test"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
TEST_PGHOST: postgres
TEST_PGPORT: 5432
TEST_PGUSER: redefined_test
TEST_PGPASSWORD: redefined_test
TEST_PGDATABASE: redefined_test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install deps
run: npm install
working-directory: backend
- name: Run integration tests
id: integration
continue-on-error: true
run: npm run test:integration:json
working-directory: backend
- name: Summarize
if: always()
run: node scripts/summarize-jest.js backend/integration-results.json "Backend Integration Test"
- name: Fail job if tests failed
if: steps.integration.outcome == 'failure'
run: exit 1
frontend-e2e:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: redefined_test
POSTGRES_PASSWORD: redefined_test
POSTGRES_DB: redefined_test
options: >-
--health-cmd "pg_isready -U redefined_test"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
PGHOST: postgres
PGPORT: 5432
PGUSER: redefined_test
PGPASSWORD: redefined_test
PGDATABASE: redefined_test
PORT: 3000
DEMO_MODE: 'true'
UPLOADS_DIR: /tmp/redefined-uploads
NODE_ENV: production
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install postgresql-client
run: apt-get update && apt-get install -y postgresql-client
- name: Load schema
run: PGPASSWORD=redefined_test psql -h postgres -U redefined_test -d redefined_test -f backend/init.sql
- name: Install backend deps
run: npm install
working-directory: backend
- name: Build and start backend
run: |
mkdir -p /tmp/redefined-uploads
npm run build
node dist/server.js &
sleep 3
working-directory: backend
- name: Install frontend deps
run: npm install
working-directory: frontend
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
working-directory: frontend
- name: Run Playwright tests
id: e2e
continue-on-error: true
env:
PLAYWRIGHT_JSON_OUTPUT_NAME: playwright-results.json
run: npx playwright test --reporter=json
working-directory: frontend
- name: Summarize
if: always()
run: node scripts/summarize-playwright.js frontend/playwright-results.json
- name: Fail job if tests failed
if: steps.e2e.outcome == 'failure'
run: exit 1