-
Notifications
You must be signed in to change notification settings - Fork 78
Daily Test Coverage Improver - Updates to complete configuration #4762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Daily Test Coverage Improver - Updates to complete configuration #4762
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
There was a problem hiding this 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 adds a GitHub Actions composite action to generate test coverage reports for the Daily Test Coverage Improver workflow. The action runs tests for both the React (/react) and backend.ai-ui (/packages/backend.ai-ui) projects, generates individual coverage reports, merges them, and uploads the results as artifacts.
Key Changes
- Adds comprehensive coverage generation workflow with setup, test execution, merging, and artifact upload
- Implements logging to
coverage-steps.logfor debugging - Generates separate and combined coverage reports using Jest and nyc
| cd react && pnpm run test -- --coverage --coverageReporters=text-summary 2>&1 | grep -A 10 "Coverage summary" | tee -a ../coverage-steps.log || true | ||
| cd .. |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step runs the full test suite again with coverage just to extract the summary. This is inefficient and will significantly increase workflow execution time since the tests have already been run in earlier steps (lines 52-69).
Instead, use npx nyc report with the existing coverage data or parse the already generated coverage reports. For example:
cd react && npx nyc report --reporter=text-summary --temp-dir=coverage 2>&1 | grep -A 10 "Coverage summary" | tee -a ../coverage-steps.log || true| cd packages/backend.ai-ui && pnpm run test -- --coverage --coverageReporters=text-summary 2>&1 | grep -A 10 "Coverage summary" | tee -a ../../coverage-steps.log || true | ||
| cd ../.. |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step runs the full test suite again with coverage just to extract the summary. This is inefficient and will significantly increase workflow execution time since the tests have already been run in earlier steps (lines 62-69).
Instead, use npx nyc report with the existing coverage data or parse the already generated coverage reports. For example:
cd packages/backend.ai-ui && npx nyc report --reporter=text-summary --temp-dir=coverage 2>&1 | grep -A 10 "Coverage summary" | tee -a ../../coverage-steps.log || true| cp react/coverage/coverage-final.json coverage/temp/react-coverage.json | ||
| cp packages/backend.ai-ui/coverage/coverage-final.json coverage/temp/backend-ai-ui-coverage.json | ||
| npx nyc merge coverage/temp coverage/combined/coverage-final.json 2>&1 | tee -a coverage-steps.log | ||
| npx nyc report --temp-dir coverage/combined --reporter=html --reporter=lcov --reporter=text-summary --report-dir coverage/combined 2>&1 | tee -a coverage-steps.log |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The npx nyc report command is using --temp-dir incorrectly. The --temp-dir option specifies where nyc should look for coverage data (typically .nyc_output/), not the final report directory.
When merging coverage, the merged coverage-final.json file should be placed in a temporary directory that nyc expects. Update the commands to:
mkdir -p .nyc_output
cp coverage/combined/coverage-final.json .nyc_output/
npx nyc report --reporter=html --reporter=lcov --reporter=text-summary --report-dir coverage/combined 2>&1 | tee -a coverage-steps.logThis ensures nyc can find the merged coverage data in its expected location.
| npx nyc report --temp-dir coverage/combined --reporter=html --reporter=lcov --reporter=text-summary --report-dir coverage/combined 2>&1 | tee -a coverage-steps.log | |
| mkdir -p .nyc_output | |
| cp coverage/combined/coverage-final.json .nyc_output/ | |
| npx nyc report --reporter=html --reporter=lcov --reporter=text-summary --report-dir coverage/combined 2>&1 | tee -a coverage-steps.log |
| - name: Run backend.ai-ui tests with coverage | ||
| shell: bash | ||
| working-directory: ./packages/backend.ai-ui | ||
| run: | | ||
| echo "Step: Running backend.ai-ui tests with coverage..." >> ../../coverage-steps.log | ||
| echo "Coverage output will be saved to: packages/backend.ai-ui/coverage/" >> ../../coverage-steps.log | ||
| pnpm run test -- --coverage --coverageDirectory=coverage 2>&1 | tee -a ../../coverage-steps.log | ||
| echo "backend.ai-ui tests completed" >> ../../coverage-steps.log |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backend.ai-ui package's jest configuration (lines 170-191 in packages/backend.ai-ui/package.json) does not include a collectCoverageFrom configuration. This means the coverage collection may include unintended files or miss important source files.
Consider adding a collectCoverageFrom configuration to the jest config in packages/backend.ai-ui/package.json similar to the React project's configuration:
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!src/**/*.d.ts"
]This ensures coverage is collected only from source files and excludes type definition files.
yomybaby
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Let's see it works.
Overview
This PR adds the coverage steps configuration needed for the Daily Test Coverage Improver workflow to systematically improve test coverage in the React and backend.ai-ui projects.
Changes
Added
.github/actions/daily-test-improver/coverage-steps/action.ymlwhich includes:react/coverage/packages/backend.ai-ui/coverage/coverage-steps.log) for debuggingCoverage Reports Generated
coverage/react/lcov-report/index.htmlcoverage/backend-ai-ui/lcov-report/index.htmlcoverage/combined/lcov-report/index.html(merged report)Testing Strategy
Each step logs its progress to
coverage-steps.logfor debugging purposes. The action handles cases where coverage generation might fail gracefully.Review Notes
Please review carefully to ensure:
What Happens Next
Once this PR is merged, the next workflow run will proceed to Phase 3, where the Daily Test Coverage Improver will:
If running in "repeat" mode, the workflow will automatically run again to proceed to Phase 3.
Related Discussion: #4760