Repository navigation
ci: gate PRs on per-workflow results checks and run unit tests - #658
Merged
Merged
Conversation
Renovate PRs could auto-merge without running any tests for the crawler, the API, the schema script or the soft-delete utility. - analysis.yml: add API tests (against a MongoDB service using the production image), unit tests for crawler, schema/script and utilities/remove-deleted-pubcode, and an `Analysis Results` job that fails if any job failed or was cancelled. - pr-open.yml: rename `Results` to `PR Results`; the utility tests move to analysis.yml. - pr-validate.yml: rename the job to `Validate Results`. - crawler and schema/script: export the logic as functions and only run the script when executed directly, so it can be tested. Refs #597
There was a problem hiding this comment.
🟢 Approval recommended
The workflow gates include all relevant jobs, and the refactors preserve scheduled behavior while adding meaningful coverage.
0 open findings
What changed in this PR
Adds comprehensive backend/unit testing and reliable per-workflow merge gates.
Changes:
- Adds API, crawler, schema, and utility tests to the analysis workflow.
- Introduces aggregate result checks for PR workflows.
- Refactors crawler and schema logic for isolated testing.
| File | Description |
|---|---|
.github/workflows/analysis.yml |
Runs test suites and adds the analysis gate. |
.github/workflows/pr-open.yml |
Renames and strengthens the PR gate. |
.github/workflows/pr-validate.yml |
Renames the validation check. |
AGENTS.md |
Documents tests and merge gates. |
api/package.json |
Adds the API test command. |
api/test/pub-code-api.test.js |
Adds MongoDB-backed API integration tests. |
crawler/package.json |
Adds the crawler test command. |
crawler/src/main.js |
Extracts testable crawler functions. |
crawler/test/main.test.js |
Tests mapping, filtering, dates, and fallback behavior. |
schema/script/index.js |
Extracts testable schema-update functions. |
schema/script/package.json |
Adds the schema test command. |
schema/script/test/index.test.js |
Tests ministry parsing and updates. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renovate PRs can auto-merge without any tests running for the crawler, the API, the schema script or the soft-delete utility. The required checks only build images and run the Cypress UI tests.
Changes
needsevery job in its workflow, runs withif: always(), and fails if any of those jobs failed or was cancelled:pr-open.yml:Resultsis renamedPR Results.analysis.yml: newAnalysis Results.pr-validate.yml: its only job is renamedValidate Results.if:and always run. The only legitimate skips are:api/test): the Express app against a MongoDB service, using the same image asdatabase/Dockerfile. They cover:.yamlfallback.pr-open.ymlto the analysis matrix.crawler/src/main.jsandschema/script/index.jsnow export their logic and only run when executed directly. Scheduled job behaviour is unchanged.After merge
To make these the merge gates, the branch rulesets need to require
PR Results,Analysis ResultsandValidate Results. That's a settings change, not part of this PR.Refs #597
Thanks for the PR!
Deployments, as required, will be available below:
Please create PRs in draft mode. Mark as ready to enable:
After merge, new images are deployed in: