Files
vigilcare-clinical/.gitea/workflows/ci.yml
T
voltsrage b8ee572194
CI / backend (push) Failing after 6m13s
CI / frontend (push) Failing after 1m28s
Change localhost to host.internal in ci.yml
2026-08-05 18:21:07 +08:00

99 lines
3.7 KiB
YAML

# Phase 36 Step 11 — build and test on every push/PR.
# Fixtures read ConnectionStrings__* / Redis__* / RabbitMq__* / Kafka__* from the
# environment (see ApiFixture / GatewayApiFixture). Dependencies come from
# docker-compose.yml so Kafka, ES, and MinIO match local integration tests —
# ApiFixture starts hosted services that require those brokers.
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Start dependency stack
run: |
docker compose up -d postgres redis rabbitmq kafka elasticsearch minio
docker compose --profile ward-gateway up -d ward-gateway-db ward-gateway-redis ward-gateway-rabbitmq
- name: Wait for Postgres (API + gateway)
run: |
for i in $(seq 1 60); do
docker compose exec -T postgres pg_isready -U postgres && break
sleep 2
done
docker compose exec -T postgres pg_isready -U postgres
docker compose exec -T ward-gateway-db pg_isready -U postgres
- name: Create test databases
run: |
docker compose exec -T postgres psql -U postgres -tc "SELECT 1 FROM pg_database WHERE datname='vigilcare_test'" \
| grep -q 1 \
|| docker compose exec -T postgres psql -U postgres -c "CREATE DATABASE vigilcare_test"
docker compose exec -T ward-gateway-db psql -U postgres -tc "SELECT 1 FROM pg_database WHERE datname='vigilcare_ward_test'" \
| grep -q 1 \
|| docker compose exec -T ward-gateway-db psql -U postgres -c "CREATE DATABASE vigilcare_ward_test"
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Restore
run: dotnet restore VigilCareClinical.sln
- name: Build
run: dotnet build VigilCareClinical.sln -c Release --no-restore
- name: Test
env:
# Defaults match docker-compose.yml published ports; fixtures fall back to these anyway.
ConnectionStrings__DefaultConnection: "Host=host.docker.internal;Port=5436;Database=vigilcare_test;Username=postgres;Password=password"
ConnectionStrings__GatewayDb: "Host=host.docker.internal;Port=5437;Database=vigilcare_ward_test;Username=postgres;Password=password"
Redis__ConnectionString: "host.docker.internal:6382,defaultDatabase=1,allowAdmin=true"
Gateway__Redis__ConnectionString: "host.docker.internal:6383,defaultDatabase=2,allowAdmin=true"
RabbitMq__Host: "host.docker.internal"
RabbitMq__Port: "5674"
Gateway__RabbitMq__Port: "5675"
Kafka__BootstrapServers: "host.docker.internal:9092"
Kafka__ReplicationFactor: "1"
Elasticsearch__Uri: "http://host.docker.internal:9200"
Minio__Endpoint: "host.docker.internal:9005"
run: |
dotnet test VigilCareClinical.sln -c Release --no-build \
--logger "trx;LogFileName=test-results.trx" \
--results-directory ./TestResults
- name: Publish test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: ./TestResults
- name: Tear down stack
if: always()
run: docker compose --profile ward-gateway down -v
frontend:
runs-on: ubuntu-latest
container:
image: node:22-alpine
steps:
- uses: actions/checkout@v4
- name: Install
working-directory: vigilcare-dashboard
run: npm ci
- name: Test
working-directory: vigilcare-dashboard
run: npm run test
- name: Build
working-directory: vigilcare-dashboard
run: npm run build