Skip to content

The agent that grows with you

ci(install-e2e): route selects specific legs, not just an OS

ethernet26c630704675
diff --git a/.github/workflows/install-e2e.yml b/.github/workflows/install-e2e.yml
index 5de0f88274d..47b681560cf 100644
--- a/.github/workflows/install-e2e.yml
+++ b/.github/workflows/install-e2e.yml
@@ -35,7 +35,8 @@ name: Install & Update E2E
# Triggers:
# * every 12 hours, so upstream drift (a new uv, a Node bump, a PyPI change)
# surfaces on a schedule rather than in someone's review cycle;
-# * manually, where you can pick the route and how many releases to sample.
+# * manually, where you can pick the route (a preset or specific legs) and how many
+# releases to sample.
#
# Deliberately NOT on pull_request: a leg takes ~11 minutes of real toolchain
# installation, and the matrix multiplies that. Updating is release-shaped work,
@@ -45,11 +46,10 @@ on:
workflow_dispatch:
inputs:
route:
- description: 'Which combinations to run. all = every OS; both/update/installer = the linux legs; windows-desktop = the windows legs; macos-desktop = the macos legs.'
+ description: 'Which legs to run: all = every OS; both/update/installer = the linux legs; windows-desktop / macos-desktop = that OS; bundled / windows-bundled / macos-bundled = the signed-bundle legs. Anything else selects legs by name (a leg or job name, or a fragment of one).'
required: false
- type: choice
+ type: string
default: all
- options: [all, both, update, installer, windows-desktop, macos-desktop, bundled, windows-bundled, macos-bundled]
windows-bundle-manifest:
description: 'HTTPS manifest pinning signed Windows OLD/NEW msixbundles; NEW must match this ref.'
type: string
@@ -84,7 +84,7 @@ on:
type: boolean
default: false
route:
- description: 'Which combinations to run. all = every OS; both/update/installer = the linux legs; windows-desktop = the windows legs; macos-desktop = the macos legs.'
+ description: 'Which legs to run: all = every OS; both/update/installer = the linux legs; windows-desktop / macos-desktop = that OS; bundled / windows-bundled / macos-bundled = the signed-bundle legs. Anything else selects legs by name (a leg or job name, or a fragment of one).'
required: false
type: string
default: all
@@ -200,19 +200,27 @@ jobs:
linux: ${{ steps.gen.outputs.linux }}
windows: ${{ steps.gen.outputs.windows }}
macos: ${{ steps.gen.outputs.macos }}
+ linux-legs: ${{ steps.gen.outputs.linux-legs }}
+ windows-legs: ${{ steps.gen.outputs.windows-legs }}
+ macos-legs: ${{ steps.gen.outputs.macos-legs }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: scripts/sandbox/generate-e2e-matrix.mjs
sparse-checkout-cone-mode: false
- id: gen
+ env:
+ # Free text on dispatch, so it reaches the script as data, never as script.
+ # Scheduled runs have no inputs: the default route.
+ ROUTE: ${{ inputs.route || 'all' }}
run: |
set -euo pipefail
matrices="$(node scripts/sandbox/generate-e2e-matrix.mjs \
- --tags '${{ needs.pick-releases.outputs.tags }}')"
+ --tags '${{ needs.pick-releases.outputs.tags }}' --route "$ROUTE")"
echo "$matrices"
for key in linux windows macos; do
echo "$key=$(echo "$matrices" | node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>console.log(JSON.stringify(JSON.parse(d)[process.argv[1]])))' "$key")" >> "$GITHUB_OUTPUT"
+ echo "$key-legs=$(echo "$matrices" | node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>console.log(JSON.parse(d)[process.argv[1]].include.length))' "$key")" >> "$GITHUB_OUTPUT"
done
# The plan, human-readable: a combination x starting-tag chart on
# the run's summary page.
@@ -274,10 +282,9 @@ jobs:
linux:
name: ${{ matrix.name }}
- # The update/installer route choices map to the linux update methods;
- # either way the whole linux matrix runs (legs are cheap and the
- # distinction wasn't worth a filter layer in the generator).
- if: github.event_name != 'workflow_dispatch' || contains(fromJSON('["all", "both", "update", "installer"]'), inputs.route)
+ # The generator applies the route; an OS it selected no legs for is skipped
+ # (GitHub rejects an empty matrix).
+ if: needs.generate-matrix.outputs.linux-legs != '0'
needs: generate-matrix
strategy:
# One leg breaking is worth knowing about even if another already
@@ -295,7 +302,7 @@ jobs:
windows:
name: ${{ matrix.name }}
- if: github.event_name != 'workflow_dispatch' || contains(fromJSON('["all", "windows-desktop"]'), inputs.route)
+ if: needs.generate-matrix.outputs.windows-legs != '0'
needs: generate-matrix
strategy:
fail-fast: false
@@ -311,7 +318,7 @@ jobs:
macos:
name: ${{ matrix.name }}
- if: github.event_name != 'workflow_dispatch' || contains(fromJSON('["all", "macos-desktop"]'), inputs.route)
+ if: needs.generate-matrix.outputs.macos-legs != '0'
needs: generate-matrix
strategy:
fail-fast: false
diff --git a/scripts/sandbox/generate-e2e-matrix.mjs b/scripts/sandbox/generate-e2e-matrix.mjs
index 6f7267bc4ee..d54159b2c82 100644
--- a/scripts/sandbox/generate-e2e-matrix.mjs
+++ b/scripts/sandbox/generate-e2e-matrix.mjs
@@ -267,6 +267,46 @@ export function buildMatrices(envs, tags) {
return byOs;
}
+/** Source-leg presets: the OS matrices each named route runs. */
+const ROUTE_OSES = /** @type {Record<string, Os[]>} */ ({
+ all: ['linux', 'windows', 'macos'],
+ both: ['linux'],
+ update: ['linux'],
+ installer: ['linux'],
+ 'windows-desktop': ['windows'],
+ 'macos-desktop': ['macos'],
+ // Bundled legs come from bundle-plan.mjs, not this matrix.
+ bundled: [],
+ 'windows-bundled': [],
+ 'macos-bundled': [],
+});
+
+/**
+ * Narrow the matrices to a route: a preset keeps whole OS matrices; anything else selects
+ * legs by name, so a leg name, a fragment of one, or a pasted job name ("<leg> / e2e") runs
+ * just those legs. A route that selects nothing throws rather than yielding a green empty run.
+ *
+ * @param {Record<Os, {include: MatrixEntry[]}>} matrices
+ * @param {string} route
+ * @returns {Record<Os, {include: MatrixEntry[]}>}
+ */
+export function selectRoute(matrices, route) {
+ const oses = ROUTE_OSES[route];
+ /** @type {(os: Os, entry: MatrixEntry) => boolean} */
+ const keep = oses
+ ? (os) => oses.includes(os)
+ : (_os, entry) => entry.name.includes(route) || route.startsWith(`${entry.name} /`);
+ /** @type {Record<Os, {include: MatrixEntry[]}>} */
+ const picked = { linux: { include: [] }, windows: { include: [] }, macos: { include: [] } };
+ for (const os of /** @type {Os[]} */ (Object.keys(picked))) {
+ picked[os].include = matrices[os].include.filter((entry) => keep(os, entry));
+ }
+ if (!oses && Object.values(picked).every((m) => m.include.length === 0)) {
+ throw new Error(`route ${JSON.stringify(route)} is not a preset and matches no leg name`);
+ }
+ return picked;
+}
+
/**
* Does this method id need the starting tag to ship the desktop app?
* Shared by the plan chart (pre-desktop cells) and the results chart
@@ -460,6 +500,7 @@ async function main() {
const { values } = parseArgs({
options: {
tags: { type: 'string', default: '[]' },
+ route: { type: 'string', default: 'all' },
format: { type: 'string', default: 'json' },
artifacts: { type: 'string' },
},
@@ -485,7 +526,7 @@ async function main() {
process.stdout.write(renderMarkdownPlan(envs, tags));
return;
}
- const matrices = buildMatrices(envs, tags);
+ const matrices = selectRoute(buildMatrices(envs, tags), values.route || 'all');
process.stdout.write(`${JSON.stringify(matrices, null, 2)}\n`);
}
diff --git a/tests-js/e2e-matrix-route.test.ts b/tests-js/e2e-matrix-route.test.ts
new file mode 100644
index 00000000000..d50561e9f8d
--- /dev/null
+++ b/tests-js/e2e-matrix-route.test.ts
@@ -0,0 +1,43 @@
+import { execFileSync } from 'node:child_process'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { expect, test } from 'vitest'
+
+const script: string = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../scripts/sandbox/generate-e2e-matrix.mjs')
+const TAGS: string = JSON.stringify([{ ref: 'v2026.6.19', desktop: true }])
+
+interface Leg {
+ name: string
+}
+type Matrices = Record<'linux' | 'windows' | 'macos', { include: Leg[] }>
+
+function generate(route: string): Matrices {
+ return JSON.parse(execFileSync(process.execPath, [script, '--tags', TAGS, '--route', route], { encoding: 'utf8' })) as Matrices
+}
+
+function legNames(matrices: Matrices): string[] {
+ return Object.values(matrices).flatMap(m => m.include.map(leg => leg.name))
+}
+
+test('a leg name, or the job name GitHub shows for it, runs exactly that leg', () => {
+ const leg: Leg | undefined = generate('all').windows.include.find(l =>
+ l.name.includes('installer-script+desktop -> desktop-installer@latest')
+ )
+
+ expect(leg).toBeDefined()
+ expect(legNames(generate(leg!.name))).toEqual([leg!.name])
+ expect(legNames(generate(`${leg!.name} / e2e`))).toEqual([leg!.name])
+})
+
+test('an OS preset runs that OS whole and no other', () => {
+ const all: Matrices = generate('all')
+ const windows: Matrices = generate('windows-desktop')
+
+ expect(legNames(windows)).toEqual(all.windows.include.map(l => l.name))
+ expect(windows.linux.include).toEqual([])
+ expect(windows.macos.include).toEqual([])
+})
+
+test('a route that selects nothing fails instead of running an empty green matrix', () => {
+ expect(() => generate('windows: no-such-method')).toThrow()
+})