Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
f13a16f
Add `report comparePipelineBundleArtifacts` for CI bundle-size diffs
ChumpChief Jun 1, 2026
e3dbc00
Add skeleton pr-bundle-size-report workflow
ChumpChief Jun 2, 2026
8b0b2a5
Address review feedback on pr-bundle-size-report
ChumpChief Jun 2, 2026
af55a51
Sync release-notes links to match pinned action SHAs
ChumpChief Jun 2, 2026
f2f6fa8
Add check_run trigger + matrix fan-out router
ChumpChief Jun 2, 2026
92e307a
Evaluate each PR against its own base branch in the router
ChumpChief Jun 2, 2026
9de4ef0
Unify pull_request_target output construction with jq
ChumpChief Jun 2, 2026
aa399cb
Rename route job to identify-targets
ChumpChief Jun 2, 2026
5ef7318
Snapshot merge-base in identify-targets and let compare just call flub
ChumpChief Jun 2, 2026
623debc
Address review findings on pr-bundle-size-report workflow
ChumpChief Jun 3, 2026
3f92bd7
Address review findings on bundle-size command + constants
ChumpChief Jun 3, 2026
3bed965
Use Build - client packages for PR-head artifacts (review finding #1)
ChumpChief Jun 3, 2026
187af8c
Scope identify-targets to check_run only; add acknowledge-pr stub
ChumpChief Jun 3, 2026
86a9840
Stub the results-sticky post in the compare job
ChumpChief Jun 3, 2026
bcdf58d
Have the results-sticky stub echo the actual comparison JSON
ChumpChief Jun 3, 2026
0fde3c4
Render the sticky-comment body in the action
ChumpChief Jun 3, 2026
2ab1175
Add workflow_dispatch trigger for manual test runs
ChumpChief Jun 3, 2026
3c625e9
Let workflow_dispatch target a different repo for fork testing
ChumpChief Jun 3, 2026
896453b
Fix workflow_dispatch input default expression
ChumpChief Jun 3, 2026
f1acaee
Use workflow's own ref for build-tools checkout on workflow_dispatch
ChumpChief Jun 3, 2026
e18edb1
Surface flub failure messages by re-running without --json
ChumpChief Jun 3, 2026
a8ba33d
Set a friendlier display name on the workflow
ChumpChief Jun 4, 2026
e90fd84
Polish workflow to production-quality stub
ChumpChief Jun 4, 2026
64397a6
Cite oclif/core#1608 in the --json workaround comment
ChumpChief Jun 4, 2026
524ace8
Redesign triggers around check_run lifecycle; drop pull_request_target
ChumpChief Jun 4, 2026
9b1654b
Split identify-targets and SHA-search the PR-head path
ChumpChief Jun 4, 2026
2ef07b9
Drop unreachable concurrency-group fallback
ChumpChief Jun 4, 2026
31b9e9b
Drop the base-branch (main / release/*) filter in identify jobs
ChumpChief Jun 4, 2026
7b2593f
Rename workflow file to match its display name
ChumpChief Jun 4, 2026
fd560d7
Drop stderr redirection on the "nothing to do" message
ChumpChief Jun 4, 2026
fd60206
Unify identify-from-pr-build's empty-result check on `// empty`
ChumpChief Jun 4, 2026
cf06e01
Let compute_mb's gh api stderr reach the log
ChumpChief Jun 4, 2026
63aca9b
Gate compute_mb on gh's exit code, not on stdout content
ChumpChief Jun 4, 2026
367a65b
Propagate compute_mb's exit code and act on it differently per job
ChumpChief Jun 4, 2026
8c1d0d1
Rewrite PR-bundle-size workflow's bash+jq sections as github-script
ChumpChief Jun 4, 2026
fa7a828
Make BuildMatch explicit in getArtifactForCommit
ChumpChief Jun 9, 2026
2357c1d
Trim verbose comments in getArtifactForCommit and pipelineConstants
ChumpChief Jun 9, 2026
e489763
Clarify comments in pr-bundle-size-comments workflow
ChumpChief Jun 9, 2026
8eb5f56
Chain acknowledge-build's post step on render outcome, clarify comments
ChumpChief Jun 9, 2026
3607675
Include base/head SHAs in pending sticky comment
ChumpChief Jun 9, 2026
0a75da3
Invert PR-guard in identify-from-pr-build, early-exit on no match
ChumpChief Jun 9, 2026
9df5e86
Drop dead PR-head clause and stale --limit 500 comment
ChumpChief Jun 9, 2026
13bfd70
Fix mispositioned release-notes comment in acknowledge-build sticky stub
ChumpChief Jun 9, 2026
3f12ae6
Cite AB#75349 in bake-in stubs and clarify compare-job needs comment
ChumpChief Jun 9, 2026
ef064c2
Drop redundant `|| true` on flub error re-run
ChumpChief Jun 9, 2026
be0655c
Tighten compare-render to `=== undefined` over `== null`
ChumpChief Jun 9, 2026
004cc74
Show absolute sizes alongside delta in changed-bundle lines
ChumpChief Jun 9, 2026
a2cf6b5
Move fluidframeworkAdoOrgUrl to azureDevops/constants.ts
ChumpChief Jun 10, 2026
6623f1c
Fix `jsdoc/check-indentation` lint error on BuildMatch tsdoc
ChumpChief Jun 10, 2026
363bcf8
Regenerate report.md doc for new comparePipelineBundleArtifacts command
ChumpChief Jun 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/changeset-reporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
pull-requests: write # for marocchino/sticky-pull-request-comment to create or update PR comment
runs-on: ubuntu-latest
steps:
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.0
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
persist-credentials: false
Expand Down
410 changes: 410 additions & 0 deletions .github/workflows/pr-bundle-size-comments.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/pr-changeset-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
name: vale
runs-on: ubuntu-latest
steps:
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.0
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
persist-credentials: false
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr-check-changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ jobs:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'changeset-required')
steps:
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.0
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
fetch-depth: "0" # all history
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha }} # Check out the head commit, not the merge commit

# install and configure node, pnpm and the changeset tools
# release notes: https://github.com/pnpm/action-setup/releases/tag/v4.2.0
# release notes: https://github.com/pnpm/action-setup/releases/tag/v5.0.0
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # ratchet:pnpm/action-setup@v5

# release notes: https://github.com/actions/setup-node/releases/tag/v6.0.0
# release notes: https://github.com/actions/setup-node/releases/tag/v6.3.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # ratchet:actions/setup-node@v6
with:
node-version-file: .nvmrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-release-branch-warning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
pull-requests: write # for marocchino/sticky-pull-request-comment to create or update PR comment
runs-on: ubuntu-latest
steps:
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.0
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
persist-credentials: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
name: Validate CODEOWNERS
runs-on: ubuntu-latest
steps:
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.0
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
persist-credentials: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push-tag-create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
fetch-depth: "0" # all history, including tags
persist-credentials: false

# release notes: https://github.com/pnpm/action-setup/releases/tag/v4.2.0
# release notes: https://github.com/pnpm/action-setup/releases/tag/v5.0.0
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # ratchet:pnpm/action-setup@v5

# release notes: https://github.com/actions/setup-node/releases/tag/v6.0.0
# release notes: https://github.com/actions/setup-node/releases/tag/v6.3.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # ratchet:actions/setup-node@v6
with:
node-version-file: .nvmrc
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-approval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
status: pending
context: Check PR approval

# release notes: https://github.com/actions/checkout/releases/tag/v6.0.0
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
# The default ref when triggered by the workflow_run event is the default branch -- main
Expand All @@ -123,10 +123,10 @@ jobs:
submodules: false

# install and configure node, pnpm and the changeset tools
# release notes: https://github.com/pnpm/action-setup/releases/tag/v4.2.0
# release notes: https://github.com/pnpm/action-setup/releases/tag/v5.0.0
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # ratchet:pnpm/action-setup@v5

# release notes: https://github.com/actions/setup-node/releases/tag/v6.0.0
# release notes: https://github.com/actions/setup-node/releases/tag/v6.3.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # ratchet:actions/setup-node@v6
with:
node-version-file: .nvmrc
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-notes-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ jobs:
runs-on: ubuntu-latest
steps:
# Check out the repo and set up node and pnpm.
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.0
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
fetch-depth: "100"
persist-credentials: false

# release notes: https://github.com/pnpm/action-setup/releases/tag/v4.2.0
# release notes: https://github.com/pnpm/action-setup/releases/tag/v5.0.0
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # ratchet:pnpm/action-setup@v5

# release notes: https://github.com/actions/setup-node/releases/tag/v6.0.0
# release notes: https://github.com/actions/setup-node/releases/tag/v6.3.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # ratchet:actions/setup-node@v6
with:
node-version-file: .nvmrc
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/website-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ jobs:
runs-on: ubuntu-latest
name: Build site
steps:
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.0
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
submodules: false

# release notes: https://github.com/pnpm/action-setup/releases/tag/v4.2.0
# release notes: https://github.com/pnpm/action-setup/releases/tag/v5.0.0
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # ratchet:pnpm/action-setup@v5

# release notes: https://github.com/actions/setup-node/releases/tag/v6.0.0
# release notes: https://github.com/actions/setup-node/releases/tag/v6.3.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # ratchet:actions/setup-node@v6
with:
node-version: "22"
Expand All @@ -60,15 +60,15 @@ jobs:
runs-on: ubuntu-latest
name: pnpm lint
steps:
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.0
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
submodules: false

# release notes: https://github.com/pnpm/action-setup/releases/tag/v4.2.0
# release notes: https://github.com/pnpm/action-setup/releases/tag/v5.0.0
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # ratchet:pnpm/action-setup@v5

# release notes: https://github.com/actions/setup-node/releases/tag/v6.0.0
# release notes: https://github.com/actions/setup-node/releases/tag/v6.3.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # ratchet:actions/setup-node@v6
with:
node-version: "22"
Expand All @@ -85,15 +85,15 @@ jobs:
name: 🧪 Website Tests
needs: build_site
steps:
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.0
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
submodules: false

# release notes: https://github.com/pnpm/action-setup/releases/tag/v4.2.0
# release notes: https://github.com/pnpm/action-setup/releases/tag/v5.0.0
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # ratchet:pnpm/action-setup@v5

# release notes: https://github.com/actions/setup-node/releases/tag/v6.0.0
# release notes: https://github.com/actions/setup-node/releases/tag/v6.3.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # ratchet:actions/setup-node@v6
with:
node-version: "22"
Expand All @@ -118,15 +118,15 @@ jobs:
name: 🔗 Broken Link Check
needs: build_site
steps:
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.0
# release notes: https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
submodules: false

# release notes: https://github.com/pnpm/action-setup/releases/tag/v4.2.0
# release notes: https://github.com/pnpm/action-setup/releases/tag/v5.0.0
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # ratchet:pnpm/action-setup@v5

# release notes: https://github.com/actions/setup-node/releases/tag/v6.0.0
# release notes: https://github.com/actions/setup-node/releases/tag/v6.3.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # ratchet:actions/setup-node@v6
with:
node-version: "22"
Expand Down
29 changes: 29 additions & 0 deletions build-tools/packages/build-cli/docs/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Report analysis about the codebase, like code coverage and bundle size measurements.

* [`flub report codeCoverage`](#flub-report-codecoverage)
* [`flub report comparePipelineBundleArtifacts`](#flub-report-comparepipelinebundleartifacts)

## `flub report codeCoverage`

Expand Down Expand Up @@ -39,3 +40,31 @@ DESCRIPTION
```

_See code: [src/commands/report/codeCoverage.ts](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/build-cli/src/commands/report/codeCoverage.ts)_

## `flub report comparePipelineBundleArtifacts`

Download ADO bundle-size artifacts for two commits and emit their per-package, per-bundle differences as JSON. Base-side artifacts come from the `Build - Client bundle size artifacts` pipeline (runs on main/release pushes); head-side artifacts come from the `Build - client packages` pipeline (runs on PR commits). Intended for the PR-comment CI workflow; for local inner-dev-loop comparisons use `check bundleSize` instead.

```
USAGE
$ flub report comparePipelineBundleArtifacts --base <value> --head <value> [--json] [-v | --quiet]

FLAGS
--base=<value> (required) Base commit SHA — the merge-base on the target branch. The baseline of the comparison.
--head=<value> (required) Head commit SHA — the PR's tip. The compare side of the comparison.

LOGGING FLAGS
-v, --verbose Enable verbose logging.
--quiet Disable all logging.

GLOBAL FLAGS
--json Format output as json.

DESCRIPTION
Download ADO bundle-size artifacts for two commits and emit their per-package, per-bundle differences as JSON.
Base-side artifacts come from the `Build - Client bundle size artifacts` pipeline (runs on main/release pushes);
head-side artifacts come from the `Build - client packages` pipeline (runs on PR commits). Intended for the PR-comment
CI workflow; for local inner-dev-loop comparisons use `check bundleSize` instead.
```

_See code: [src/commands/report/comparePipelineBundleArtifacts.ts](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/build-cli/src/commands/report/comparePipelineBundleArtifacts.ts)_
17 changes: 8 additions & 9 deletions build-tools/packages/build-cli/src/commands/check/bundleSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import { execFileSync } from "node:child_process";
import { Flags } from "@oclif/core";

import { fluidframeworkAdoOrgUrl } from "../../library/azureDevops/constants.js";
import { getArtifactForCommit } from "../../library/azureDevops/getArtifactForCommit.js";
import { getAzureDevopsApi } from "../../library/azureDevops/getAzureDevopsApi.js";
import {
bundleSizeArtifactsBaselinePipeline,
compareJsonReportsByPackage,
extractAnalyzerJsonsFromArtifact,
type PackageComparison,
Expand Down Expand Up @@ -40,7 +42,7 @@ function formatComparison(comparison: PackageComparison): string[] {
const fmt = (before: number, after: number): string => {
const delta = after - before;
const sign = delta > 0 ? "+" : "";
return `${before} -> ${after} (${sign}${delta})`;
return `${before} ${after} (${sign}${delta})`;
};

const lines: string[] = [];
Expand Down Expand Up @@ -129,16 +131,13 @@ export default class CheckBundleSize extends BaseCommand<typeof CheckBundleSize>
this.log(`Baseline commit: ${baselineCommit}`);

// Public ADO project — anonymous reads are fine at this command's scale.
const adoApi = getAzureDevopsApi(undefined, "https://dev.azure.com/fluidframework");
const adoApi = getAzureDevopsApi(undefined, fluidframeworkAdoOrgUrl);
const artifactContents = await getArtifactForCommit({
adoApi,
// Published by the `Build - Client bundle size artifacts` pipeline.
artifactName: "bundleAnalyzerJson",
commit: baselineCommit,
// `Build - Client bundle size artifacts` in the `public` project.
// Source-of-truth: tools/pipelines/build-bundle-size-artifacts.yml.
definitionId: 48,
project: "public",
artifactName: bundleSizeArtifactsBaselinePipeline.bundleAnalyzerJsonArtifactName,
match: { kind: "commit", sha: baselineCommit },
definitionId: bundleSizeArtifactsBaselinePipeline.definitionId,
project: bundleSizeArtifactsBaselinePipeline.project,
});

const baselineJsons = extractAnalyzerJsonsFromArtifact(artifactContents);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import {
isCodeCoverageCriteriaPassed,
} from "../../codeCoverage/compareCodeCoverage.js";
import { getCommentForCodeCoverageDiff } from "../../codeCoverage/getCommentForCodeCoverage.js";
import type { IAzureDevopsBuildCoverageConstants } from "../../library/azureDevops/constants.js";
import {
fluidframeworkAdoOrgUrl,
type IAzureDevopsBuildCoverageConstants,
} from "../../library/azureDevops/constants.js";
import { BaseCommand } from "../../library/commands/base.js";
import {
createOrUpdateCommentOnPr,
Expand Down Expand Up @@ -78,7 +81,7 @@ export default class ReportCodeCoverageCommand extends BaseCommand<

const artifactNamePrefix = "Code Coverage Report";
const codeCoverageConstantsForBaseline: IAzureDevopsBuildCoverageConstants = {
orgUrl: "https://dev.azure.com/fluidframework",
orgUrl: fluidframeworkAdoOrgUrl,
projectName: "public",
ciBuildDefinitionId: flags.adoCIBuildDefinitionIdBaseline,
artifactName: artifactNamePrefix,
Expand All @@ -87,7 +90,7 @@ export default class ReportCodeCoverageCommand extends BaseCommand<
};

const codeCoverageConstantsForPR: IAzureDevopsBuildCoverageConstants = {
orgUrl: "https://dev.azure.com/fluidframework",
orgUrl: fluidframeworkAdoOrgUrl,
projectName: "public",
ciBuildDefinitionId: flags.adoCIBuildDefinitionIdPR,
artifactName: artifactNamePrefix,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

import { Flags } from "@oclif/core";

import { fluidframeworkAdoOrgUrl } from "../../library/azureDevops/constants.js";
import { getArtifactForCommit } from "../../library/azureDevops/getArtifactForCommit.js";
import { getAzureDevopsApi } from "../../library/azureDevops/getAzureDevopsApi.js";
import {
bundleSizeArtifactsBaselinePipeline,
bundleSizeArtifactsPrPipeline,
compareJsonReportsByPackage,
extractAnalyzerJsonsFromArtifact,
type PackageComparison,
} from "../../library/bundleSize/index.js";
import { BaseCommand } from "../../library/commands/base.js";

/**
* Result serialized to stdout by `--json`.
*/
interface ComparePipelineBundleArtifactsResult {
baseCommit: string;
headCommit: string;
comparison: PackageComparison;
}

export default class ComparePipelineBundleArtifacts extends BaseCommand<
typeof ComparePipelineBundleArtifacts
> {
static readonly description =
`Download ADO bundle-size artifacts for two commits and emit their per-package, per-bundle differences as JSON. Base-side artifacts come from the \`Build - Client bundle size artifacts\` pipeline (runs on main/release pushes); head-side artifacts come from the \`Build - client packages\` pipeline (runs on PR commits). Intended for the PR-comment CI workflow; for local inner-dev-loop comparisons use \`check bundleSize\` instead.`;

static readonly enableJsonFlag = true;

static readonly flags = {
base: Flags.string({
description:
"Base commit SHA — the merge-base on the target branch. The baseline of the comparison.",
required: true,
}),
head: Flags.string({
description: "Head commit SHA — the PR's tip. The compare side of the comparison.",
required: true,
}),
...BaseCommand.flags,
} as const;

public async run(): Promise<ComparePipelineBundleArtifactsResult> {
const { base, head } = this.flags;

// Public ADO project — anonymous reads are fine at this command's scale.
const adoApi = getAzureDevopsApi(undefined, fluidframeworkAdoOrgUrl);

const baseArtifact = await getArtifactForCommit({
adoApi,
artifactName: bundleSizeArtifactsBaselinePipeline.bundleAnalyzerJsonArtifactName,
match: { kind: "commit", sha: base },
definitionId: bundleSizeArtifactsBaselinePipeline.definitionId,
project: bundleSizeArtifactsBaselinePipeline.project,
});
const baseJsons = extractAnalyzerJsonsFromArtifact(baseArtifact);
if (baseJsons.size === 0) {
this.error(`Base artifact contains no analyzer.json files for commit ${base}.`);
}

const headArtifact = await getArtifactForCommit({
adoApi,
artifactName: bundleSizeArtifactsPrPipeline.bundleAnalyzerJsonArtifactName,
match: { kind: "prHead", sha: head },
definitionId: bundleSizeArtifactsPrPipeline.definitionId,
project: bundleSizeArtifactsPrPipeline.project,
});
const headJsons = extractAnalyzerJsonsFromArtifact(headArtifact);
if (headJsons.size === 0) {
this.error(`Head artifact contains no analyzer.json files for commit ${head}.`);
}

const comparison = compareJsonReportsByPackage(baseJsons, headJsons);

return { baseCommit: base, headCommit: head, comparison };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Licensed under the MIT License.
*/

/** ADO organization URL hosting Fluid Framework's pipelines. */
export const fluidframeworkAdoOrgUrl = "https://dev.azure.com/fluidframework";

export interface IAzureDevopsBuildCoverageConstants {
/**
* URL for the ADO org.
Expand Down
Loading
Loading