fix: auto-cleanup stale recently browsed items #75
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: Halkyone 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 9) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.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: '9.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 | |
| NEXT_PUBLIC_GRAPHQL_URL: http://127.0.0.1:34732/graphql | |
| NEXT_PUBLIC_GRAPHQL_WS_URL: ws://127.0.0.1:34732/graphql | |
| NEXTAUTH_SECRET: "ci-secret-halkyone" | |
| NEXTAUTH_URL: http://127.0.0.1:3671 | |
| - 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 3671) | |
| (cd emr-client && npm start -- -p 3671) & | |
| # Wait for services to be 100% Healthy | |
| npx wait-on -t 600000 http://127.0.0.1:34732/health http://127.0.0.1:3671 | |
| # SEEDING BUFFER: Give the cloud runner 60s to finish the heavy database seeding | |
| echo "Services online. Waiting 60s for clinical seeding to finalize..." | |
| sleep 60 | |
| echo "Clinical seeding complete. Starting Playwright suite." | |
| # Run Playwright (Executing all clinical and booking workflows in a single idempotent pass) | |
| echo "Executing Full Clinical Suite..." | |
| (cd emr-client && npx playwright test --project=chromium --workers=1 --grep-invert "Screenshot Generator") | |
| env: | |
| CI: "true" | |
| 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 | |
| NEXT_PUBLIC_GRAPHQL_URL: http://127.0.0.1:34732/graphql | |
| NEXT_PUBLIC_GRAPHQL_WS_URL: ws://127.0.0.1:34732/graphql | |
| SeedSettings__InitialAdminPassword: ${{ secrets.INITIAL_ADMIN_PASSWORD || 'Halkyone@Initial!2026' }} | |
| SeedSettings__InitialPractitionerPassword: ${{ secrets.INITIAL_PRACTITIONER_PASSWORD || 'HalcyonPractitioner@Initial!2026' }} | |
| # Keep these for Playwright as well | |
| INITIAL_ADMIN_PASSWORD: ${{ secrets.INITIAL_ADMIN_PASSWORD || 'Halkyone@Initial!2026' }} | |
| NEXTAUTH_SECRET: "ci-secret-halkyone" | |
| NEXTAUTH_URL: http://127.0.0.1:3671 | |
| 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 | |
| deploy: | |
| name: Continuous Deployment (GHCR & Demo) | |
| needs: [containerize] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push Backend Image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./emr-server/Dockerfile | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}/emr-backend:latest | |
| ghcr.io/${{ github.repository }}/emr-backend:${{ github.sha }} | |
| - name: Trigger Demo Deployment (Optional) | |
| run: | | |
| echo "Backend image pushed to GHCR." | |
| echo "To complete CD to a free provider like Render or Railway:" | |
| echo "1. Connect your Render/Railway service to the GHCR image." | |
| echo "2. Add a RENDER_DEPLOY_HOOK secret to your GitHub Repo." | |
| # curl -X POST ${{ secrets.RENDER_DEPLOY_HOOK }} |