name: HG002 Accuracy on: workflow_dispatch: pull_request: types: [opened, synchronize, reopened, labeled] branches: [main] paths: - .github/workflows/hg002-accuracy.yml - scripts/ci/hg002-* - modules/local/deepvariant/** - nextflow.config - conf/base.config - conf/containers.config - versions.env permissions: contents: read concurrency: group: hg002-accuracy-${{ github.sha }} cancel-in-progress: false jobs: accuracy: if: >- github.event_name == 'workflow_dispatch' || (contains(github.event.pull_request.labels.*.name, 'hg002-accuracy') && (github.event.action != 'labeled' || github.event.label.name == 'hg002-accuracy')) runs-on: ubuntu-latest timeout-minutes: 330 steps: - name: Free and verify benchmark disk space shell: bash run: | docker_root=$(docker info --format '{{.DockerRootDir}}') echo 'Disk before cleanup' sudo df -h "$RUNNER_TEMP" "$docker_root" sudo rm -rf -- /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL docker image prune --all --force echo 'Disk after cleanup' sudo df -h "$RUNNER_TEMP" "$docker_root" # 16.27 decimal GB observed, plus 25% headroom, rounded up to KiB. required_kib=19860840 for path in "$RUNNER_TEMP" "$docker_root"; do available_kib=$(sudo df -Pk "$path" | awk 'NR == 2 {print $4}') if [[ ! "$available_kib" =~ ^[0-9]+$ ]] || (( available_kib < required_kib )); then echo "ERROR: HG002 Accuracy needs at least $required_kib KiB (20.34 GB) free on $path after cleanup. Found ${available_kib:-unknown} KiB." >&2 exit 1 fi done - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ github.sha }} fetch-depth: 0 persist-credentials: false - name: Verify the accuracy floors and release dispatch source shell: bash run: | if [[ "$GITHUB_EVENT_NAME" == workflow_dispatch ]]; then scripts/ci/check-release.sh accuracy-source "$GITHUB_REF" "$GITHUB_SHA" "$GITHUB_REF_PROTECTED" fi if [ ! -s scripts/ci/hg002-accuracy-chr20.tsv ]; then echo "ERROR: full-chr20 floors must be calibrated before a release accuracy run" >&2 exit 1 fi - name: Resolve the pipeline's Nextflow version id: nf shell: bash run: | source versions.env printf 'version=%s\n' "$NEXTFLOW_VERSION" >> "$GITHUB_OUTPUT" - uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 with: distribution: temurin java-version: '17' - uses: "nf-core/setup-nextflow@c66f1bfa2dc817ae23f4b34eaa26fa5f1453ca71" # v3.1.0 with: version: ${{ steps.nf.outputs.version }} - name: Call and score full public HG002 chr20 id: call shell: bash timeout-minutes: 319 run: | test "$(git rev-parse HEAD)" = "$GITHUB_SHA" report="$RUNNER_TEMP/hg002-accuracy" if ! scripts/ci/hg002-runner-resources.sh "$report" \ scripts/ci/hg002-release-evidence.sh measure "$RUNNER_TEMP/hg002-work" "$report/baseline" \ > "$RUNNER_TEMP/hg002-benchmark.log" 2>&1; then tail -n 80 "$RUNNER_TEMP/hg002-benchmark.log" >&2 echo 'ERROR: The full-chr20 benchmark did not finish. See the resource report and task trace.' >&2 exit 1 fi cat "$report/baseline/scores.tsv" >> "$GITHUB_STEP_SUMMARY" git diff --quiet HEAD scripts/ci/hg002-release-evidence.sh scores "$report/baseline/chr20.summary.csv" echo 'passed=true' >> "$GITHUB_OUTPUT" - name: Verify the gate rejects a Nextflow-only coverage regression if: github.event_name == 'pull_request' && steps.call.outputs.passed == 'true' shell: bash run: | work="$RUNNER_TEMP/hg002-work" report="$RUNNER_TEMP/hg002-accuracy" # The published baseline is a copy. Reclaim only its task work directory. rm -rf -- "$work/tasks" module=modules/local/deepvariant/main.nf trap 'git restore -- "$module"' EXIT sed -i "s/def regions = deepvariant_regions(capture_bed)/def regions = '--regions chr20:10000000-10500000'/" "$module" test "$(git diff --name-only HEAD)" = "$module" git diff -- "$module" if ! scripts/ci/hg002-runner-resources.sh "$report/control-resources" \ scripts/ci/hg002-release-evidence.sh measure "$work" "$report/control" \ > "$RUNNER_TEMP/hg002-regression.log" 2>&1; then tail -n 80 "$RUNNER_TEMP/hg002-regression.log" >&2 echo 'ERROR: The narrowed Nextflow benchmark did not finish. See its resource report and task trace.' >&2 exit 1 fi cat "$report/control/scores.tsv" >> "$GITHUB_STEP_SUMMARY" if scripts/ci/hg002-release-evidence.sh scores "$report/control/chr20.summary.csv" \ > /dev/null 2> "$report/control/gate.stderr"; then echo 'ERROR: The accuracy gate accepted the narrowed Nextflow callset.' >&2 exit 1 fi cat "$report/control/gate.stderr" grep -Eq '^SNP recall [0-9.]+ is below the chr20 floor [0-9.]+$' "$report/control/gate.stderr" cat "$report/control/gate.stderr" >> "$GITHUB_STEP_SUMMARY" - name: Archive failed benchmark diagnostics if: failure() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: hg002-full-chr20-calibration-${{ github.sha }} path: | ${{ runner.temp }}/hg002-benchmark.log ${{ runner.temp }}/hg002-regression.log ${{ runner.temp }}/hg002-accuracy/resources.tsv ${{ runner.temp }}/hg002-accuracy/time.txt ${{ runner.temp }}/hg002-accuracy/*/chr20.summary.csv ${{ runner.temp }}/hg002-accuracy/*/scores.tsv ${{ runner.temp }}/hg002-accuracy/*/call-checksums.sha256 ${{ runner.temp }}/hg002-accuracy/*/input-checksums.sha256 ${{ runner.temp }}/hg002-accuracy/*/images.tsv ${{ runner.temp }}/hg002-accuracy/*/nextflow-trace.tsv ${{ runner.temp }}/hg002-accuracy/*/SHA256SUMS ${{ runner.temp }}/hg002-accuracy/*/source-revision.txt if-no-files-found: ignore overwrite: true - name: Archive the Nextflow regression measurements if: always() && github.event_name == 'pull_request' && steps.call.outputs.passed == 'true' uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: hg002-full-chr20-nextflow-regression-${{ github.sha }} path: | ${{ runner.temp }}/hg002-accuracy/control-resources/resources.tsv ${{ runner.temp }}/hg002-accuracy/control-resources/time.txt ${{ runner.temp }}/hg002-accuracy/control/nextflow-trace.tsv ${{ runner.temp }}/hg002-accuracy/control/chr20.summary.csv ${{ runner.temp }}/hg002-accuracy/control/scores.tsv ${{ runner.temp }}/hg002-accuracy/control/gate.stderr if-no-files-found: ignore overwrite: true - name: Upload the passing full-chr20 evidence if: steps.call.outputs.passed == 'true' uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: hg002-full-chr20-gate-${{ github.sha }}-attempt-${{ github.run_attempt }} path: | ${{ runner.temp }}/hg002-accuracy/resources.tsv ${{ runner.temp }}/hg002-accuracy/time.txt ${{ runner.temp }}/hg002-accuracy/baseline/chr20.summary.csv ${{ runner.temp }}/hg002-accuracy/baseline/scores.tsv ${{ runner.temp }}/hg002-accuracy/baseline/call-checksums.sha256 ${{ runner.temp }}/hg002-accuracy/baseline/input-checksums.sha256 ${{ runner.temp }}/hg002-accuracy/baseline/images.tsv ${{ runner.temp }}/hg002-accuracy/baseline/nextflow-trace.tsv ${{ runner.temp }}/hg002-accuracy/baseline/SHA256SUMS ${{ runner.temp }}/hg002-accuracy/baseline/source-revision.txt if-no-files-found: error overwrite: true