finalProject/.github/workflows/test-environment.yml
2025-05-23 16:51:31 +02:00

71 lines
No EOL
1.5 KiB
YAML

name: Test Environment Setup
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
setup-test-environment:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: schoolproject
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: 10.8.0
run_install: false
- name: Install dependencies
run: pnpm install
- name: Setup Backend
run: |
cd Backend
cp .env.example .env
pnpm build
- name: Run Tests
run: |
# Backend tests
cd Backend
pnpm test || echo "No backend tests found or tests failed"
# Frontend tests with Cypress
cd ../Client
pnpm cypress run || echo "No frontend tests found or tests failed"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
Backend/test-results
Client/cypress/screenshots
Client/cypress/videos