Skip to content

ci: gate PRs on per-workflow results checks and run unit tests - #658

Merged
DerekRoberts merged 3 commits into
mainfrom
ci/597-results-and-tests
Oct 9, 2026
Merged

DerekRoberts merged 3 commits into
mainfrom
ci/597-results-and-tests

Conversation

@DerekRoberts

@DerekRoberts DerekRoberts commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

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

  • Results checks, one per PR workflow (same pattern as quickstart-openshift). Each needs every job in its workflow, runs with if: always(), and fails if any of those jobs failed or was cancelled:
    • pr-open.yml: Results is renamed PR Results.
    • analysis.yml: new Analysis Results.
    • pr-validate.yml: its only job is renamed Validate Results.
  • No path filters. Test jobs have no if: and always run. The only legitimate skips are:
    • Trivy on draft PRs.
    • Jobs downstream of a failed job, and that failure already fails Results.
  • API tests (api/test): the Express app against a MongoDB service, using the same image as database/Dockerfile. They cover:
    • API-key checks on bulk-load and delete.
    • Request validation.
    • Bulk-load insert, replace and invalid-entry skip.
    • The flattened list.
    • Soft delete hiding an entry, and a later bulk-load restoring it.
  • Crawler tests: YAML-to-entry mapping, including the legacy version field; skipping archived repos and repos with no default branch; the one-day update window; and the .yaml fallback.
  • Schema script tests: reading ministry names from the page HTML and from the published schema, and updating the enum only when the lists differ.
  • Utility tests move from pr-open.yml to the analysis matrix.
  • Refactor for testability: crawler/src/main.js and schema/script/index.js now 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 Results and Validate 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:

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
Copilot AI balanced review requested due to automatic review settings October 9, 2026 01:56
@DerekRoberts DerekRoberts self-assigned this Oct 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 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.

@DerekRoberts DerekRoberts moved this from Active to Waiting in DevOps (NR) Oct 9, 2026

@mishraomp mishraomp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

more tests , yay 🥳

@DerekRoberts
DerekRoberts enabled auto-merge (squash) October 9, 2026 18:36
@DerekRoberts
DerekRoberts merged commit 42801e9 into main Oct 9, 2026
17 checks passed
@DerekRoberts
DerekRoberts deleted the ci/597-results-and-tests branch October 9, 2026 18:40
@DerekRoberts DerekRoberts mentioned this pull request Oct 9, 2026
10 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants