wsi-annotation-tests 0.1.3

DICOM Annotation Test Suite for WSI ANN, SEG, SR, and Parametric Map
Documentation
name: DICOM Annotation Test Suite

on:
  push:
  pull_request:
  workflow_dispatch:
    inputs:
      annotations_ref:
        description: wsi-dicom-annotations branch, tag, or commit to test
        required: true
        default: d3e11f7fcd2d263fb3391f6c826c35bfc5d9e217
        type: string
      run_full:
        description: Run validators, Orthanc, and 1M/5M scale cases
        required: true
        default: false
        type: boolean
      orthanc_executable:
        description: Absolute Orthanc path on the full-profile runner
        required: false
        type: string

permissions:
  contents: read

concurrency:
  group: interop-${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  core:
    runs-on: ubuntu-latest
    timeout-minutes: 45
    steps:
      - name: Checkout harness
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          path: wsi-annotation-tests
          persist-credentials: false

      - name: Checkout wsi-dicom-annotations
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          repository: frames-sg/wsi-dicom-annotations
          ref: ${{ inputs.annotations_ref || 'd3e11f7fcd2d263fb3391f6c826c35bfc5d9e217' }}
          path: wsi-dicom-annotations
          persist-credentials: false

      - name: Install Rust
        uses: dtolnay/rust-toolchain@70dec6087f2cb6bab9fbac4da23160afbe848e91 # 1.99.0
        with:
          components: rustfmt, clippy

      - name: Install uv
        uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
        with:
          enable-cache: true

      - name: Verify cross-repository core gate
        working-directory: wsi-annotation-tests
        env:
          WSI_DICOM_ANNOTATIONS_ROOT: ${{ github.workspace }}/wsi-dicom-annotations
        run: ./scripts/check-core.sh

      - name: Publish core-profile run directory
        if: always()
        working-directory: wsi-annotation-tests
        env:
          ANNOTATION_PROBE: ${{ github.workspace }}/wsi-dicom-annotations/target/debug/annotation_probe
          RUN_ID: github-${{ github.run_id }}-${{ github.run_attempt }}-core
        run: |
          set +e
          target/release/wsi-annotation-tests run-core \
            --probe "${ANNOTATION_PROBE}" \
            --results results \
            --run-id "${RUN_ID}"
          profile_status=$?
          set -e
          if [[ -d "results/${RUN_ID}" ]]; then
            tar -czf "results/${RUN_ID}.tar.gz" -C results "${RUN_ID}"
            sha256sum "results/${RUN_ID}.tar.gz" > "results/${RUN_ID}.tar.gz.sha256"
            sha256sum "results/${RUN_ID}/manifest.json" > "results/${RUN_ID}.manifest.sha256"
          fi
          exit "${profile_status}"

      - name: Upload core-profile results
        if: always()
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: wsi-annotation-tests-core-${{ github.run_id }}-${{ github.run_attempt }}
          path: |
            wsi-annotation-tests/results/github-${{ github.run_id }}-${{ github.run_attempt }}-core/
            wsi-annotation-tests/results/github-${{ github.run_id }}-${{ github.run_attempt }}-core.tar.gz
            wsi-annotation-tests/results/github-${{ github.run_id }}-${{ github.run_attempt }}-core.tar.gz.sha256
            wsi-annotation-tests/results/github-${{ github.run_id }}-${{ github.run_attempt }}-core.manifest.sha256
          if-no-files-found: error

  full:
    if: github.event_name == 'workflow_dispatch' && inputs.run_full
    needs: core
    runs-on: [self-hosted, Linux, X64, wsi-interop]
    timeout-minutes: 120
    steps:
      - name: Checkout harness
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          path: wsi-annotation-tests
          persist-credentials: false

      - name: Checkout wsi-dicom-annotations
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          repository: frames-sg/wsi-dicom-annotations
          ref: ${{ inputs.annotations_ref || 'd3e11f7fcd2d263fb3391f6c826c35bfc5d9e217' }}
          path: wsi-dicom-annotations
          persist-credentials: false

      - name: Install Rust
        uses: dtolnay/rust-toolchain@70dec6087f2cb6bab9fbac4da23160afbe848e91 # 1.99.0
        with:
          components: rustfmt, clippy

      - name: Install uv
        uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0

      - name: Run explicit full gate
        working-directory: wsi-annotation-tests
        env:
          WSI_DICOM_ANNOTATIONS_ROOT: ${{ github.workspace }}/wsi-dicom-annotations
          ORTHANC_EXECUTABLE: ${{ inputs.orthanc_executable }}
          RUN_ID: github-${{ github.run_id }}-${{ github.run_attempt }}
        run: ./scripts/check-full.sh

      - name: Hash full-profile bundle
        if: always()
        working-directory: wsi-annotation-tests
        env:
          RUN_ID: github-${{ github.run_id }}-${{ github.run_attempt }}
        run: |
          if [[ -d "results/${RUN_ID}" ]]; then
            tar -czf "results/${RUN_ID}.tar.gz" -C results "${RUN_ID}"
            sha256sum "results/${RUN_ID}.tar.gz" > "results/${RUN_ID}.tar.gz.sha256"
            sha256sum "results/${RUN_ID}/manifest.json" > "results/${RUN_ID}.manifest.sha256"
          fi

      - name: Upload full-profile results
        if: always()
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: wsi-annotation-tests-${{ github.run_id }}-${{ github.run_attempt }}
          path: wsi-annotation-tests/results/
          if-no-files-found: error