Skip to content

Conversation

@pkuczynski
Copy link
Collaborator

@pkuczynski pkuczynski commented Nov 11, 2025

Description of change

Add single step to validate if all tests passed, which will be used for branch protection rules

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • This pull request links relevant issues as Fixes #00000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change

Summary by CodeRabbit

  • Chores
    • Renamed an internal CI workflow for clarity.
    • Refined which workflow files are picked up by CI.
    • Added an overall "all-passed" CI job that runs reliably and enforces that dependent jobs must succeed before the pipeline is marked passed, improving build validation and reliability.

@pkuczynski pkuczynski self-assigned this Nov 11, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 2025

Walkthrough

The GitHub Actions workflow was renamed from "Commit Validation" to "Tests", the file-pattern filter was narrowed to .github/workflows/test*.yml, and a new all-passed job was added to aggregate the statuses of build, coverage, docs, formatting, tests-linux, and tests-windows, returning non‑zero on any failure.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow Updates
\.github/workflows/tests.yml
Renamed workflow to "Tests"; narrowed glob pattern for file selection to .github/workflows/test*.yml; added new all-passed job that depends on build, coverage, docs, formatting, tests-linux, and tests-windows and exits non‑zero if any dependency failed.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Dev as Developer Push
    participant GH as GitHub Actions
    participant Build as build
    participant Coverage as coverage
    participant Docs as docs
    participant Format as formatting
    participant TL as tests-linux
    participant TW as tests-windows
    participant All as all-passed

    Dev->>GH: push triggers `Tests` workflow (test*.yml)
    GH->>Build: start build
    GH->>Coverage: start coverage
    GH->>Docs: start docs
    GH->>Format: start formatting
    GH->>TL: start tests-linux
    GH->>TW: start tests-windows

    note right of All `#D6EAF8`: Aggregator job\n(always runs)
    All->>Build: wait for completion
    All->>Coverage: wait for completion
    All->>Docs: wait for completion
    All->>Format: wait for completion
    All->>TL: wait for completion
    All->>TW: wait for completion
    alt any dependent job failed
        All-->>GH: exit 1 (failure aggregate)
    else all dependencies succeeded
        All-->>GH: exit 0 (success)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Review the all-passed job logic and exit code handling (ensure it reliably reflects dependent job states).
  • Verify the narrowed glob .github/workflows/test*.yml still matches all intended workflow files and doesn’t unintentionally omit others.
  • Confirm there are no ordering or concurrency regressions introduced by adding the aggregator job.

Possibly related PRs

Suggested reviewers

  • mguida22
  • gioboa

Poem

🐰 A tiny hop through YAML green,
Tests retitled, patterns clean,
An all‑passed watcher keeps the gate,
Hopping when builds co‑operate. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly reflects the main change: adding a CI step to validate that all tests passed, which matches the workflow enhancement described in the raw summary.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Member

@michaelbromley michaelbromley left a comment

Choose a reason for hiding this comment

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

Note on why this PR exists:

We noticed that it was possible to merge a PR even when checks were failing or not yet completed. The only restriction to prevent merge was the 2 review minimum.

So I then altered the settings to require all the tests to pass before one can merge.

However, this then means that targeted workflows that do not run tests (e.g. PRs just on docs that don't need to run tests) would not be mergable, since the tests didn't run.

Apparently GH Actions does not support this level of control natively.

So this solution allows us to require just this one single job "all-passed" to succeed, and then merge is allowed. In the case of e.g. docs PRs where tests are skipped, the "all-passed" will still succeed because it only fails on "failure" in any of the dependent jobs, and will ignore "skipped" jobs.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8db792 and 3dfa454.

📒 Files selected for processing (1)
  • .github/workflows/tests.yml (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: tests-linux (20) / mssql
  • GitHub Check: tests-linux (20) / mysql_mariadb_latest
  • GitHub Check: tests-linux (20) / mysql_mariadb
  • GitHub Check: tests-linux (20) / sap
  • GitHub Check: tests-linux (20) / sqlite
  • GitHub Check: tests-linux (20) / postgres (17)
  • GitHub Check: tests-linux (20) / postgres (14)
  • GitHub Check: tests-linux (20) / cockroachdb
  • GitHub Check: tests-linux (20) / oracle
  • GitHub Check: tests-linux (18) / postgres (17)
  • GitHub Check: tests-linux (18) / postgres (14)
  • GitHub Check: tests-linux (18) / sap
  • GitHub Check: tests-linux (18) / oracle
  • GitHub Check: tests-linux (18) / mssql
  • GitHub Check: tests-linux (18) / mysql_mariadb_latest
  • GitHub Check: tests-linux (18) / mysql_mariadb
  • GitHub Check: tests-windows / better-sqlite3
  • GitHub Check: tests-windows / sqljs
  • GitHub Check: tests-windows / sqlite
🔇 Additional comments (1)
.github/workflows/tests.yml (1)

34-34: Confirm this behavior change is intentional—prior logic explicitly avoided triggering tests on workflow changes.

The pattern test*.yml is safe and specific (matches only tests.yml, tests-linux.yml, tests-windows.yml), with no cascading or circular dependency risks detected. However, git history shows commit 4955db92 explicitly decided to "dont run tests on workflow changes," and this PR reverses that decision. Verify this policy shift is intentional before merging.

Comment on lines +116 to +127
all-passed:
runs-on: ubuntu-latest
if: always()
needs:
- build
- coverage
- docs
- formatting
- tests-linux
- tests-windows
steps:
- run: exit ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the needs.*.result syntax for aggregating job statuses.

The all-passed job uses contains(needs.*.result, 'failure') to aggregate the results of 6 dependent jobs. While the intent is clear—exit with code 1 if any job failed, 0 otherwise—confirm that the needs.*.result expansion correctly evaluates to an array containing all job results in your GitHub Actions version.

A few observations:

  • The job correctly uses if: always() to ensure it runs regardless of upstream failures.
  • Skipped jobs (due to conditional if statements on upstream jobs) will not appear as 'failure', so they won't block the check. This is correct for selective test execution.
  • The job depends on all major test/validation jobs, ensuring comprehensive coverage for branch protection rules.

Alternatively, for more explicit error reporting, you could check each job individually: exit ${{ (needs.build.result == 'failure' || needs.coverage.result == 'failure' || ...) && 1 || 0 }}. However, the current approach is concise and appropriate if the needs.*.result array expansion works as expected.


🏁 Script executed:

#!/bin/bash
# Search for existing examples of needs.*.result usage in the repository
rg -nP 'needs\.\*\.result' .github/workflows/

Length of output: 102


🌐 Web query:

GitHub Actions needs.*.result syntax job results array

💡 Result:

Short answer: needs.<job_id>.result is a string (one of "success", "failure", "cancelled", "skipped") for a specific dependent job. The needs context is an object keyed by job id (needs.jobA, needs.jobB, ...), not an ordered array — there is no built-in needs.*.result array to iterate. To check multiple job results you must reference each job (e.g. needs.build.result, needs.test.result) or explicitly list/collect outputs into a single job output that you parse. [1][2]

Example:

  • Access single job result: ${{ needs.build.result }}.
  • No array form like needs.*.result exists; to aggregate, write step outputs to a job output and read/parse that output in the downstream job. [1][2]

Sources:

  1. GitHub Actions contexts reference (needs and jobs contexts). [docs].
  2. Examples/explanations of job outputs and needs usage.


Fix: needs.*.result is not valid GitHub Actions syntax and must be replaced with explicit job result checks.

The needs context in GitHub Actions is an object keyed by job id (not an array), so needs.*.result does not exist. The contains() function will not receive an actual array of results, and the aggregation will fail.

Line 127: Replace with explicit job-by-job checks:

- run: exit ${{ (needs.build.result == 'failure' || needs.coverage.result == 'failure' || needs.docs.result == 'failure' || needs.formatting.result == 'failure' || needs.tests-linux.result == 'failure' || needs.tests-windows.result == 'failure') && 1 || 0 }}

Alternatively, use a reusable step or structured output approach to avoid the verbose conditional.

🤖 Prompt for AI Agents
.github/workflows/tests.yml around lines 116 to 127: the step using
contains(needs.*.result, 'failure') is invalid because needs is an object keyed
by job id, not an array; replace that expression with explicit per-job result
checks (e.g., check needs.build.result, needs.coverage.result,
needs.docs.result, needs.formatting.result, needs.tests-linux.result,
needs.tests-windows.result combined with || to produce exit code 1 if any are
'failure'), or alternatively implement a reusable step/aggregate output that
computes a single boolean result and reference that instead.

Copy link
Collaborator

@gioboa gioboa left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@pkuczynski pkuczynski merged commit 52a96ad into typeorm:master Nov 12, 2025
63 checks passed
@pkuczynski pkuczynski deleted the ci/tests-all-passed branch November 12, 2025 09:51
ThbltLmr pushed a commit to ThbltLmr/typeorm that referenced this pull request Dec 2, 2025
mgohin pushed a commit to mgohin/typeorm that referenced this pull request Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants