fix: claim submission date of service #3449
Workflow file for this run
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: EHR E2E Tests | |
| env: | |
| NODE_VERSION: 22 | |
| TEST_RESULTS_CACHE_RETENTION_DAYS: 30 | |
| SECRETS_REPOSITORY: ${{ vars.SECRETS_REPOSITORY }} # Secrets repository for configuration files | |
| PLAYWRIGHT_CACHE_PATH: ~/.cache/ms-playwright | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment to run tests on' | |
| required: true | |
| type: choice | |
| options: | |
| - local | |
| - testing | |
| - development | |
| - staging | |
| - demo | |
| default: 'local' | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| branches: [main, develop, 'release/**'] | |
| jobs: | |
| check-changes: | |
| if: github.event.pull_request.draft == false || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| outputs: | |
| should-run: ${{ steps.check.outputs.should-run }} | |
| skip-reason: ${{ steps.check.outputs.skip-reason }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 2 # Need at least 2 commits to compare | |
| - name: Check if EHR changes are relevant | |
| id: check | |
| run: | | |
| TRACKED_FILES=$(node -e " | |
| const config = require('./.github/trigger-paths.js'); | |
| console.log(config.getE2EPaths('ehr').join(' ')); | |
| ") | |
| node .github/check-changed-files.js $TRACKED_FILES | |
| ehr-e2e-tests-run: | |
| needs: check-changes | |
| if: always() && !cancelled() && needs.check-changes.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest-8-cores | |
| timeout-minutes: 40 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Restore node modules | |
| id: npm-cache-restore | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-npm- | |
| - name: Install dependencies | |
| if: steps.npm-cache-restore.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - name: Restore Playwright browsers | |
| id: playwright-cache-restore | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ${{ env.PLAYWRIGHT_CACHE_PATH }} | |
| key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-playwright- | |
| - name: Install Playwright browsers | |
| run: npx playwright install chromium | |
| - name: Check out secrets repo | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| repository: ${{ env.SECRETS_REPOSITORY }} | |
| ssh-key: ${{ secrets.DEPLOY_OTTEHR_KEY }} | |
| path: 'secrets' | |
| - name: Setup environment | |
| run: | | |
| setup_env() { | |
| mkdir -p "packages/zambdas/.env" | |
| cp secrets/zambdas/* "packages/zambdas/.env" | |
| mkdir -p "apps/$app/env" | |
| cp "secrets/$app/app/tests."*.json "apps/$app/env/" | |
| cp "secrets/$app/app/.env"* "apps/$app/env/" | |
| } | |
| for app in ehr intake; do | |
| setup_env "$app" | |
| done | |
| - name: Run E2E tests | |
| run: | | |
| if [ "${{ github.event.inputs.environment }}" == "local" ] || [ "${{ github.event_name }}" == "pull_request" ]; then | |
| npm run ehr:e2e:local:integration | |
| else | |
| npm run ehr:e2e:${{ github.event.inputs.environment }} | |
| fi | |
| env: | |
| CI: true | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: playwright-report-ehr-${{ github.event.inputs.environment || 'local' }} | |
| path: | | |
| apps/ehr/playwright-report/ | |
| apps/ehr/test-results/ | |
| retention-days: ${{ env.TEST_RESULTS_CACHE_RETENTION_DAYS }} | |
| # This job always runs and satisfies branch protection rules | |
| ehr-e2e-tests: | |
| needs: [check-changes, ehr-e2e-tests-run] | |
| if: always() && !cancelled() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Report status | |
| run: | | |
| if [ "${{ needs.check-changes.outputs.should-run }}" == "false" ]; then | |
| echo "EHR E2E tests skipped: ${{ needs.check-changes.outputs.skip-reason }}" | |
| exit 0 | |
| elif [ "${{ needs.ehr-e2e-tests-run.result }}" == "success" ]; then | |
| echo "EHR E2E tests passed" | |
| exit 0 | |
| elif [ "${{ needs.ehr-e2e-tests-run.result }}" == "failure" ]; then | |
| echo "EHR E2E tests failed" | |
| exit 1 | |
| elif [ "${{ needs.ehr-e2e-tests-run.result }}" == "cancelled" ]; then | |
| echo "EHR E2E tests cancelled" | |
| exit 1 | |
| else | |
| echo "EHR E2E tests status unknown: ${{ needs.ehr-e2e-tests-run.result }}" | |
| exit 1 | |
| fi |