name: OHIF Downstream Validation # Pull requests: add a line to the PR body, same style as OHIF uses for CS3D_REF: # OHIF_REF: # If omitted, Viewers ref defaults to master. workflow_dispatch can set ohif_ref instead. on: pull_request: workflow_dispatch: inputs: ohif_ref: description: >- OHIF Viewers branch or tag (e.g. master, beta). On pull_request you can instead add a line "OHIF_REF: " to the PR body. required: false default: 'master' permissions: contents: read pull-requests: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: ohif-downstream: name: OHIF downstream tests against this PR runs-on: [nashua] timeout-minutes: 120 env: BUN_VERSION: 1.2.23 NODE_VERSION: 24.15.0 OHIF_REF: master OHIF_DIR: ohif # Update to force a rebuild of the OHIF integration BUILD_INDEX: 0 steps: - name: Checkout Cornerstone uses: actions/checkout@v6.0.3 with: ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} - name: Resolve OHIF ref (PR body OHIF_REF line or workflow_dispatch input) run: bash scripts/ci/ohif-ref-resolve.sh env: GH_TOKEN: ${{ github.token }} EVENT_NAME: ${{ github.event_name }} REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }} OHIF_REF_INPUT: ${{ github.event.inputs.ohif_ref }} DEFAULT_REF: master - name: Log build context (OHIF/CS3D branch and version for build diagnosis) run: | echo "::notice::Build type: ohif-downstream | CS3D: ${{ github.repository }}@${{ github.ref }} (${{ github.sha }}) | OHIF ref: ${{ env.OHIF_REF }}" CS3D_BRANCH=$(git rev-parse --abbrev-ref HEAD) CS3D_SHA=$(git rev-parse --short HEAD) echo "[build-context] ═══════════════════════════════════════════════════════════════" echo "[build-context] Build type: ohif-downstream (CS3D repo validating against OHIF)" echo "[build-context] CS3D branch: $CS3D_BRANCH | CS3D SHA: $CS3D_SHA" echo "[build-context] OHIF ref: ${{ env.OHIF_REF }}" echo "[build-context] ═══════════════════════════════════════════════════════════════" - name: Set up pnpm uses: pnpm/action-setup@v6.0.8 # OHIF (a bun/yarn project) is installed with bun so it gets an isolated # node_modules instead of being pulled into this repo's pnpm workspace, # which mixes jest copies and breaks jest-runner (leakDetector error). - name: Set up Bun uses: oven-sh/setup-bun@v2.2.0 with: bun-version: ${{ env.BUN_VERSION }} - name: Set up Node uses: actions/setup-node@v6.4.0 with: node-version: ${{ env.NODE_VERSION }} cache: 'pnpm' - name: Install Cornerstone dependencies run: pnpm install --frozen-lockfile - name: Build local Cornerstone packages for OHIF (includes metadata) run: pnpm run build:esm - name: Checkout OHIF uses: actions/checkout@v6.0.3 with: repository: OHIF/Viewers ref: ${{ env.OHIF_REF }} path: ${{ env.OHIF_DIR }} fetch-depth: 1 submodules: recursive - name: Log build context (OHIF/CS3D branch and version for build diagnosis) run: | CS3D_BRANCH=$(git rev-parse --abbrev-ref HEAD) CS3D_SHA=$(git rev-parse HEAD) OHIF_BRANCH=$(git -C "${OHIF_DIR}" rev-parse --abbrev-ref HEAD) OHIF_SHA=$(git -C "${OHIF_DIR}" rev-parse HEAD) echo "::notice::Build type: ohif-downstream | OHIF: OHIF/Viewers@${OHIF_BRANCH} (${OHIF_SHA}) | CS3D: ${{ github.repository }}@${CS3D_BRANCH} (${CS3D_SHA})" echo "[build-context] ═══════════════════════════════════════════════════════════════" echo "[build-context] Build type: ohif-downstream (CS3D repo validating against OHIF)" echo "[build-context] OHIF checkout: ${OHIF_BRANCH} (${OHIF_SHA}) | CS3D checkout: ${CS3D_BRANCH} (${CS3D_SHA})" echo "[build-context] ═══════════════════════════════════════════════════════════════" - name: Install OHIF dependencies working-directory: ${{ env.OHIF_DIR }} run: bun install - name: Link local Cornerstone packages into OHIF node_modules run: node scripts/link-ohif-cornerstone-node-modules.mjs ${{ env.OHIF_DIR }} - name: Run OHIF unit tests working-directory: ${{ env.OHIF_DIR }} run: bun run test:unit:ci - name: Install Playwright browsers working-directory: ${{ env.OHIF_DIR }} run: npx playwright install chromium - name: Run OHIF e2e tests working-directory: ${{ env.OHIF_DIR }} env: PLAYWRIGHT_HTML_OPEN: never run: bash "$GITHUB_WORKSPACE/scripts/ci/with-nashua-lock.sh" bun run test:e2e:ci - name: Upload OHIF Playwright artifacts if: always() uses: actions/upload-artifact@v7.0.1 with: name: ohif-playwright-artifacts-${{ github.sha }} path: | ${{ env.OHIF_DIR }}/tests/playwright-report.json ${{ env.OHIF_DIR }}/tests/playwright-report/ ${{ env.OHIF_DIR }}/tests/test-results/ retention-days: 7