186 lines
6.5 KiB
YAML
186 lines
6.5 KiB
YAML
# Backend stays local (onboarding §6 escape hatch): fixtures need RabbitMQ,
|
|
# Kafka, Elasticsearch, MinIO, and a second logical DB — beyond stock
|
|
# dotnet8-ci (Postgres + Redis services only). Frontend uses shared node-ci.
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
paths:
|
|
- "VigilCareClinicalAPI/**"
|
|
- "VigilCare.WardGateway/**"
|
|
- "VigilCare.ClinicalContracts/**"
|
|
- "VigilCare.ClinicalContracts.Tests/**"
|
|
- "VigilCareClinicalAPI.Tests/**"
|
|
- "VigilCare.WardGateway.Tests/**"
|
|
- "VigilCare.Simulation.Core/**"
|
|
- "VigilCare.Simulator/**"
|
|
- "vigilcare-dashboard/**"
|
|
- "VigilCareClinical.sln"
|
|
- "scripts/ci-*.sh"
|
|
- ".gitea/workflows/**"
|
|
pull_request:
|
|
branches: [master]
|
|
paths:
|
|
- "VigilCareClinicalAPI/**"
|
|
- "VigilCare.WardGateway/**"
|
|
- "VigilCare.ClinicalContracts/**"
|
|
- "VigilCare.ClinicalContracts.Tests/**"
|
|
- "VigilCareClinicalAPI.Tests/**"
|
|
- "VigilCare.WardGateway.Tests/**"
|
|
- "VigilCare.Simulation.Core/**"
|
|
- "VigilCare.Simulator/**"
|
|
- "vigilcare-dashboard/**"
|
|
- "VigilCareClinical.sln"
|
|
- "scripts/ci-*.sh"
|
|
- ".gitea/workflows/**"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
backend: ${{ steps.filter.outputs.backend }}
|
|
frontend: ${{ steps.filter.outputs.frontend }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- id: filter
|
|
name: Detect stack changes
|
|
run: |
|
|
set -euo pipefail
|
|
backend=false
|
|
frontend=false
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
backend=true
|
|
frontend=true
|
|
else
|
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
base="${{ github.event.pull_request.base.sha }}"
|
|
else
|
|
base="${{ github.event.before }}"
|
|
fi
|
|
if [ -z "${base:-}" ] || [ "$base" = "0000000000000000000000000000000000000000" ]; then
|
|
backend=true
|
|
frontend=true
|
|
else
|
|
files="$(git diff --name-only "$base" "${{ github.sha }}")"
|
|
printf '%s\n' "$files"
|
|
if printf '%s\n' "$files" | grep -qE '^(VigilCareClinicalAPI/|VigilCare\.WardGateway/|VigilCare\.ClinicalContracts|VigilCareClinicalAPI\.Tests/|VigilCare\.WardGateway\.Tests/|VigilCare\.Simulation\.Core/|VigilCare\.Simulator/|VigilCareClinical\.sln|scripts/ci-|\.gitea/workflows/)'; then
|
|
backend=true
|
|
fi
|
|
if printf '%s\n' "$files" | grep -qE '^(vigilcare-dashboard/|\.gitea/workflows/)'; then
|
|
frontend=true
|
|
fi
|
|
fi
|
|
fi
|
|
echo "backend=${backend}" >> "$GITHUB_OUTPUT"
|
|
echo "frontend=${frontend}" >> "$GITHUB_OUTPUT"
|
|
|
|
backend:
|
|
needs: changes
|
|
if: needs.changes.outputs.backend == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: builtin:checkout
|
|
|
|
- name: Start dependency sidecars
|
|
run: bash scripts/ci-start-sidecars.sh
|
|
|
|
- name: Setup .NET 8
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: "8.0.x"
|
|
cache: true
|
|
cache-dependency-path: "**/*.csproj"
|
|
|
|
- name: Restore
|
|
run: dotnet restore VigilCareClinical.sln
|
|
|
|
- name: Build
|
|
run: dotnet build VigilCareClinical.sln -c Release --no-restore
|
|
|
|
- name: Test (isolated — no service database)
|
|
env:
|
|
ConnectionStrings__DefaultConnection: ""
|
|
ConnectionStrings__GatewayDb: ""
|
|
Redis__ConnectionString: ""
|
|
Gateway__Redis__ConnectionString: ""
|
|
RabbitMq__Host: ""
|
|
DOTNET_PROCESSOR_COUNT: "1"
|
|
DOTNET_gcServer: "0"
|
|
DOTNET_GCHeapCount: "1"
|
|
GITEA_TOKEN: ""
|
|
ASPNETCORE_ENVIRONMENT: Testing
|
|
run: |
|
|
set -euo pipefail
|
|
dotnet test VigilCare.ClinicalContracts.Tests/VigilCare.ClinicalContracts.Tests.csproj \
|
|
-c Release --no-build \
|
|
--blame-hang-timeout 2m \
|
|
--logger "trx;LogFileName=ClinicalContracts.Tests.trx" \
|
|
--results-directory ./TestResults \
|
|
-- xUnit.MaxParallelThreads=1
|
|
|
|
- name: Test (against sidecars)
|
|
env:
|
|
ConnectionStrings__DefaultConnection: "Host=ci-pg;Port=5432;Database=vigilcare_test;Username=postgres;Password=postgres;SSL Mode=Disable"
|
|
ConnectionStrings__GatewayDb: "Host=ci-pg;Port=5432;Database=vigilcare_ward_test;Username=postgres;Password=postgres;SSL Mode=Disable"
|
|
Redis__ConnectionString: "ci-redis:6379,defaultDatabase=1,allowAdmin=true"
|
|
Gateway__Redis__ConnectionString: "ci-redis:6379,defaultDatabase=2,allowAdmin=true"
|
|
RabbitMq__Host: "ci-rmq"
|
|
RabbitMq__Port: "5672"
|
|
RabbitMq__Username: "ciuser"
|
|
RabbitMq__Password: "cipass"
|
|
Gateway__RabbitMq__Host: "ci-rmq"
|
|
Gateway__RabbitMq__Port: "5672"
|
|
Kafka__BootstrapServers: "ci-kafka:9092"
|
|
Kafka__ReplicationFactor: "1"
|
|
Kafka__SecurityProtocol: "Plaintext"
|
|
Elasticsearch__Uri: "http://ci-es:9200"
|
|
Minio__Endpoint: "ci-minio:9000"
|
|
Minio__UseSSL: "false"
|
|
ASPNETCORE_ENVIRONMENT: Testing
|
|
DOTNET_PROCESSOR_COUNT: "1"
|
|
DOTNET_gcServer: "0"
|
|
DOTNET_GCHeapCount: "1"
|
|
GITEA_TOKEN: ""
|
|
run: |
|
|
set -euo pipefail
|
|
for proj in \
|
|
VigilCareClinicalAPI.Tests/VigilCareClinicalAPI.Tests.csproj \
|
|
VigilCare.WardGateway.Tests/VigilCare.WardGateway.Tests.csproj
|
|
do
|
|
name="$(basename "$proj" .csproj)"
|
|
echo "::group::$name"
|
|
dotnet test "$proj" -c Release --no-build \
|
|
--blame-hang-timeout 2m \
|
|
--logger "trx;LogFileName=${name}.trx" \
|
|
--results-directory ./TestResults \
|
|
-- xUnit.MaxParallelThreads=1
|
|
echo "::endgroup::"
|
|
done
|
|
|
|
- name: Publish test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-results
|
|
path: ./TestResults
|
|
|
|
- name: Tear down sidecars
|
|
if: always()
|
|
run: bash scripts/ci-stop-sidecars.sh
|
|
|
|
frontend:
|
|
needs: changes
|
|
if: needs.changes.outputs.frontend == 'true'
|
|
uses: infra/ci-workflows/.gitea/workflows/node-ci.yml@v1
|
|
with:
|
|
working_directory: vigilcare-dashboard
|
|
node_version: "22"
|
|
lint_command: "true"
|
|
extra_check_command: npm run test
|
|
build_command: npm run build
|