Skip to content

Fix false “no unit-test or coverage files found” failure in release Unit Tests job#2889

Merged
pethers merged 2 commits into
mainfrom
copilot/fix-unit-tests-job
Jun 4, 2026
Merged

Fix false “no unit-test or coverage files found” failure in release Unit Tests job#2889
pethers merged 2 commits into
mainfrom
copilot/fix-unit-tests-job

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 4, 2026

The release workflow’s Unit Tests job was failing despite Vitest passing and generating reports. The failure came from the artifact-presence guard in release.yml, not from Vite/Vitest output generation itself.

  • Root cause

    • In .github/workflows/release.yml, the guard used:
      • find builds -type f | grep -q . under set -o pipefail
    • grep -q exits early after first match, which triggers a broken pipe on find (find: write error), making the pipeline non-zero and falsely tripping the failure path.
  • Fix

    • Replaced the pipe-based check with a single-process-safe probe:
      • if [ -z "$(find builds -type f -print -quit)" ]; then ... fi
    • This preserves the intended behavior (fail only when builds/ is truly empty) and removes pipefail/SIGPIPE flakiness.
  • Config alignment review (no code changes)

    • Verified vitest.config.js already targets builds/coverage and builds/test-results with configured reporters/output files.
    • Verified release/deploy report publishing flow remains aligned with existing docs/report upload patterns.
# before
if ! find builds -type f | grep -q .; then
  echo "::error::No unit-test or coverage files found under builds/ — check vitest/coverage configuration."
  exit 1
fi

# after
if [ -z "$(find builds -type f -print -quit)" ]; then
  echo "::error::No unit-test or coverage files found under builds/ — check vitest/coverage configuration."
  exit 1
fi

@github-actions github-actions Bot added the size-xs Extra small change (< 10 lines) label Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: size-xs

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job "Unit Tests" Fix false “no unit-test or coverage files found” failure in release Unit Tests job Jun 4, 2026
Copilot AI requested a review from pethers June 4, 2026 06:52
@github-actions github-actions Bot added workflow GitHub Actions workflows ci-cd CI/CD pipeline changes labels Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers marked this pull request as ready for review June 4, 2026 06:59
Copilot AI review requested due to automatic review settings June 4, 2026 06:59
@pethers pethers merged commit b963c17 into main Jun 4, 2026
14 checks passed
@pethers pethers deleted the copilot/fix-unit-tests-job branch June 4, 2026 07:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the release workflow’s Unit Tests job to avoid a false failure caused by a find | grep -q guard running under set -o pipefail, where grep -q can terminate early and trigger a broken pipe error.

Changes:

  • Replaced the pipe-based “any files under builds/” check with a find ... -print -quit probe to avoid SIGPIPE/pipefail flakiness.

# Defense-in-depth: fail attribution stays on Unit Tests rather
# than the downstream deploy-docs job ("Artifact not found").
if ! find builds -type f | grep -q .; then
if [ -z "$(find builds -type f -print -quit)" ]; then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-cd CI/CD pipeline changes size-xs Extra small change (< 10 lines) workflow GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants