Skip to content

Commit ebb796f

Browse files
authored
ci: skip webapp and internal tests for changes to packages they don't depend on (#4911)
CLI-only PRs currently run the full webapp and internal test suites because the `webapp` and `internal` filters match all of `packages/**`. This narrows them to the packages the webapp and internal packages actually depend on. Changes to `cli-v3`, `react-hooks`, `python` and `rsc` now only run their own suites (packages, CLI e2e, sdk-compat). The exclusions live in a separate `shared_packages` filter step because negation patterns only work with `predicate-quantifier: every`, and that would break the multi-path `webapp` and `internal` filters.
1 parent b9c8498 commit ebb796f

2 files changed

Lines changed: 29 additions & 6 deletions

File tree

.github/workflows/pr_checks.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
outputs:
2121
code: ${{ steps.code_filter.outputs.code }}
2222
typecheck_self: ${{ steps.filter.outputs.typecheck_self }}
23-
webapp: ${{ steps.filter.outputs.webapp }}
23+
webapp: ${{ steps.filter.outputs.webapp == 'true' || steps.shared_packages_filter.outputs.shared_packages == 'true' }}
2424
packages: ${{ steps.filter.outputs.packages }}
25-
internal: ${{ steps.filter.outputs.internal }}
25+
internal: ${{ steps.filter.outputs.internal == 'true' || steps.shared_packages_filter.outputs.shared_packages == 'true' }}
2626
obsmap: ${{ steps.filter.outputs.obsmap }}
2727
cli: ${{ steps.filter.outputs.cli }}
2828
sdk: ${{ steps.filter.outputs.sdk }}
@@ -62,7 +62,6 @@ jobs:
6262
- '.github/workflows/code-quality.yml'
6363
webapp:
6464
- 'apps/webapp/**'
65-
- 'packages/**'
6665
- 'internal-packages/**'
6766
- '.github/workflows/pr_checks.yml'
6867
- '.github/workflows/unit-tests-webapp.yml'
@@ -85,7 +84,6 @@ jobs:
8584
- 'turbo.json'
8685
internal:
8786
- 'internal-packages/**'
88-
- 'packages/**'
8987
- '.github/workflows/pr_checks.yml'
9088
- '.github/workflows/unit-tests-internal.yml'
9189
- '.configs/**'
@@ -111,7 +109,7 @@ jobs:
111109
#
112110
# Deliberately NOT here: this package's own paths, and packages/plugins/src and
113111
# internal-packages/rbac/src, the other two trees webappSymbols.test.ts reads.
114-
# `internal` above already matches `internal-packages/**` and `packages/**`, and
112+
# `internal` above already matches `internal-packages/**` and the shared packages, and
115113
# `unit-tests-internal.yml` runs `turbo run test --filter "@internal/*"`, which picks up
116114
# @internal/observability-map and runs the same vitest suite. Listing them here as well
117115
# ran the suite twice on every PR touching them, which was this filter's own doing.
@@ -148,6 +146,19 @@ jobs:
148146
- 'pnpm-workspace.yaml'
149147
- 'turbo.json'
150148
149+
# Only the packages the webapp and internal packages depend on; the rest run their own suites.
150+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
151+
id: shared_packages_filter
152+
with:
153+
predicate-quantifier: every
154+
filters: |
155+
shared_packages:
156+
- 'packages/**'
157+
- '!packages/cli-v3/**'
158+
- '!packages/react-hooks/**'
159+
- '!packages/python/**'
160+
- '!packages/rsc/**'
161+
151162
code-quality:
152163
uses: ./.github/workflows/code-quality.yml
153164

internal-packages/observability-map/src/integration.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,20 @@ describe("the package's tests are wired into the gate", () => {
255255
expect(obsmap).not.toContain("internal-packages/rbac");
256256

257257
const internal = text.split(" internal:")[1]!.split(" obsmap:")[0]!;
258-
expect(internal).toContain(`'${PATH_PREFIX}packages/**'`);
259258
expect(internal).toContain(`'${PATH_PREFIX}internal-packages/**'`);
259+
260+
// Whichever filter carries packages/** into `internal`, plugins must stay in it.
261+
const sharedBlock = text.split(" shared_packages:")[1];
262+
if (sharedBlock) {
263+
const shared = sharedBlock.split("\n code-quality:")[0]!;
264+
expect(shared).toContain(`'${PATH_PREFIX}packages/**'`);
265+
expect(shared).not.toContain("packages/plugins");
266+
expect(text).toContain(
267+
"internal: ${{ steps.filter.outputs.internal == 'true' || steps.shared_packages_filter.outputs.shared_packages == 'true' }}"
268+
);
269+
} else {
270+
expect(internal).toContain(`'${PATH_PREFIX}packages/**'`);
271+
}
260272
});
261273

262274
// Naming this package here as well ran the suite twice on every pull request touching it. Asserted

0 commit comments

Comments
 (0)