Fix: CI Issue 6 #45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Halcyon Clinical OS CI | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master ] | |
| permissions: | |
| contents: read | |
| security-events: write | |
| jobs: | |
| backend: | |
| name: Backend Pipeline (.NET 10) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Restore dependencies | |
| run: dotnet restore emr-server/emr-server.slnx | |
| - name: Build (Release) | |
| run: dotnet build emr-server/emr-server.slnx --configuration Release --no-restore | |
| - name: Run Unit Tests | |
| run: dotnet test emr-server/emr-server.slnx --configuration Release --no-build --verbosity normal | |
| clinical-verification: | |
| name: Clinical Verification (Build & Playwright) | |
| needs: [backend] | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: emr | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: emr-client/package-lock.json | |
| - name: Install dependencies | |
| run: | | |
| cd emr-client && npm ci | |
| npx playwright install --with-deps chromium | |
| - name: Build Backend | |
| run: dotnet build emr-server/emr-server.slnx --configuration Release | |
| - name: Production Build (Frontend) | |
| run: cd emr-client && npm run build | |
| env: | |
| NEXT_PUBLIC_API_URL: http://127.0.0.1:34732 | |
| NEXTAUTH_SECRET: "ci-secret-halcyon" | |
| NEXTAUTH_URL: http://127.0.0.1:3431 | |
| - name: Run E2E Tests | |
| run: | | |
| # Ensure Database is fully awake | |
| npx wait-on tcp:127.0.0.1:5432 | |
| # Start Backend (Enforcing Production, Port, and ignoring local profiles) | |
| export ASPNETCORE_ENVIRONMENT=Production | |
| cd emr-server/src/Api && dotnet run --no-build --no-launch-profile --configuration Release --urls "http://127.0.0.1:34732" -- --seed & | |
| # Start Frontend (Forcing port 3431) | |
| cd emr-client && npm start -- -p 3431 & | |
| # Wait for ports to be open (10-min timeout for slow cloud seeding) | |
| # We wait for the TCP ports instead of the /health endpoint to avoid hangs during DB seeding | |
| npx wait-on -t 600000 tcp:127.0.0.1:34732 tcp:127.0.0.1:3431 | |
| echo "Services are online. Starting Playwright suite." | |
| # Run Playwright | |
| cd emr-client && npx playwright test tests/clinical-workflow.spec.ts --project=chromium --workers=1 | |
| env: | |
| ASPNETCORE_ENVIRONMENT: Production | |
| ConnectionStrings__DefaultConnection: "Host=127.0.0.1;Database=emr;Username=postgres;Password=postgres" | |
| NEXT_PUBLIC_API_URL: http://127.0.0.1:34732 | |
| NEXTAUTH_SECRET: "ci-secret-halcyon" | |
| NEXTAUTH_URL: http://127.0.0.1:3431 | |
| Logging__LogLevel__Default: Warning | |
| Serilog__MinimumLevel__Default: Warning | |
| - name: Upload Test Report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: emr-client/playwright-report/ | |
| retention-days: 30 | |
| containerize: | |
| name: Container Security & Build | |
| needs: [backend, clinical-verification] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Local Images (Validation) | |
| run: | | |
| docker compose build |