70 lines
1.5 KiB
YAML
70 lines
1.5 KiB
YAML
name: Integration Tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main, master, develop]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
integration-tests:
|
|
name: Integration Tests
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
postgres:
|
|
image: ghcr.io/insforge/postgres:v15.13.2
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: insforge
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U postgres"
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
|
|
env:
|
|
PGHOST: 127.0.0.1
|
|
PGPORT: 5432
|
|
PGUSER: postgres
|
|
PGPASSWORD: postgres
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install Postgres client
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y postgresql-client
|
|
|
|
- name: Wait for Postgres
|
|
run: |
|
|
for i in {1..60}; do
|
|
if pg_isready -h 127.0.0.1 -p 5432 -U postgres; then
|
|
exit 0
|
|
fi
|
|
sleep 2
|
|
done
|
|
echo "postgres not ready in time"
|
|
exit 1
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run integration tests
|
|
run: cd backend && npm run test:integration
|