Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automation: Main Next Integrate #16259

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions api-report/container-runtime.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,6 @@ export enum RuntimeMessage {

// @public
export interface SubmitSummaryFailureData {
// Warning: (ae-forgotten-export) The symbol "SummaryStage" needs to be exported by the entry point index.d.ts
//
// (undocumented)
stage: SummaryStage;
}
Expand Down Expand Up @@ -747,6 +745,9 @@ export class SummaryCollection extends TypedEventEmitter<ISummaryCollectionOpEve
waitSummaryAck(referenceSequenceNumber: number): Promise<IAckedSummary>;
}

// @public
export type SummaryStage = SubmitSummaryResult["stage"] | "unknown";

// @public
export const TombstoneResponseHeaderKey = "isTombstoned";

Expand Down
2 changes: 1 addition & 1 deletion api-report/driver-base.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promise<{
}>;

// @public (undocumented)
export function validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number, logger: ITelemetryLoggerExt): void;
export function validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number, logger: ITelemetryLoggerExt, strict?: boolean): void;

// (No @packageDocumentation comment for this package)

Expand Down
2 changes: 1 addition & 1 deletion build-tools/lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.20.0",
"version": "0.21.0",
"npmClient": "pnpm",
"useWorkspaces": true
}
2 changes: 1 addition & 1 deletion build-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "root",
"version": "0.20.0",
"version": "0.21.0",
"private": true,
"homepage": "https://fluidframework.com",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion build-tools/packages/build-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fluid-tools/build-cli",
"version": "0.20.0",
"version": "0.21.0",
"description": "Build tools for the Fluid Framework",
"homepage": "https://fluidframework.com",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ export default class GenerateUpcomingCommand extends BaseCommand<typeof Generate
let body: string = "";
for (const change of changes) {
if (change.changeTypes.includes(flags.releaseType)) {
body += `## ${change.summary} (${getDisplayDate(change.added)})\n\n${
change.content
}\n\n`;
body += `## ${change.summary}\n\n${change.content}\n\n`;
} else {
this.info(
`Excluding changeset: ${path.basename(change.sourceFile)} because it has no ${
Expand Down
2 changes: 1 addition & 1 deletion build-tools/packages/build-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fluidframework/build-tools",
"version": "0.20.0",
"version": "0.21.0",
"description": "Fluid Build tools",
"homepage": "https://fluidframework.com",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import * as chalk from "chalk";
import detectIndent from "detect-indent";
import * as fs from "fs";
import { readFileSync, readJsonSync, writeJsonSync } from "fs-extra";
import { sync as globSync, hasMagic } from "glob";
import * as path from "path";
import sortPackageJson from "sort-package-json";

Expand Down
15 changes: 15 additions & 0 deletions build-tools/packages/build-tools/src/common/taskUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
import * as path from "path";
import { existsSync } from "fs";
import { lookUpDirSync, readFileAsync } from "./utils";

export function getEsLintConfigFilePath(dir: string) {
// TODO: we currently don't support .yaml and .yml, or config in package.json
Expand All @@ -16,3 +17,17 @@ export function getEsLintConfigFilePath(dir: string) {
}
return undefined;
}

export async function getInstalledPackageVersion(packageName: string, cwd: string) {
const resolvedPath = require.resolve(packageName, { paths: [cwd] });
const packageJsonPath = await lookUpDirSync(resolvedPath, (currentDir) => {
return existsSync(path.join(currentDir, "package.json"));
});
if (packageJsonPath === undefined) {
throw new Error(`Unable to find package ${packageName} from ${cwd}`);
}
const packageJson = JSON.parse(
await readFileAsync(path.join(packageJsonPath, "package.json"), "utf8"),
);
return packageJson.version;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
import { getInstalledPackageVersion } from "../../../common/taskUtils";
import { TscDependentTask } from "./tscTask";

export class ApiExtractorTask extends TscDependentTask {
protected get configFileFullPath() {
return this.getPackageFileFullPath("api-extractor.json");
}

protected async getToolVersion() {
return getInstalledPackageVersion("@microsoft/api-extractor", this.node.pkg.directory);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
import { getEsLintConfigFilePath } from "../../../common/taskUtils";
import { getEsLintConfigFilePath, getInstalledPackageVersion } from "../../../common/taskUtils";
import { TscDependentTask } from "./tscTask";

export class TsLintTask extends TscDependentTask {
protected get configFileFullPath() {
return this.getPackageFileFullPath("tslint.json");
}

protected async getToolVersion() {
return getInstalledPackageVersion("tslint", this.node.pkg.directory);
}
}

export class EsLintTask extends TscDependentTask {
Expand All @@ -30,4 +34,8 @@ export class EsLintTask extends TscDependentTask {
}
return false;
}

protected async getToolVersion() {
return getInstalledPackageVersion("eslint", this.node.pkg.directory);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import * as path from "path";

import { existsSync, globFn, readFileAsync, statAsync } from "../../../common/utils";
import { BuildPackage } from "../../buildGraph";
import { LeafTask, LeafWithDoneFileTask } from "./leafTask";
import { LeafWithDoneFileTask } from "./leafTask";
import { getInstalledPackageVersion } from "../../../common/taskUtils";

export class PrettierTask extends LeafWithDoneFileTask {
private parsed: boolean = false;
Expand Down Expand Up @@ -104,7 +105,10 @@ export class PrettierTask extends LeafWithDoneFileTask {
return { name, hash };
});
const hashes = await Promise.all(hashesP);
return JSON.stringify(hashes);
return JSON.stringify({
version: await getInstalledPackageVersion("prettier", this.node.pkg.directory),
hashes,
});
} catch (e) {
this.traceExec(`error generating done file content. ${e}`);
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as ts from "typescript";

import { defaultLogger } from "../../../common/logging";
import { existsSync, readFileAsync } from "../../../common/utils";
import { getInstalledPackageVersion } from "../../../common/taskUtils";
import * as TscUtils from "../../../common/tscUtils";
import { LeafTask, LeafWithDoneFileTask } from "./leafTask";

Expand All @@ -23,6 +24,7 @@ interface ITsBuildInfo {
semanticDiagnosticsPerFile?: any[];
options: any;
};
version: string;
}

export class TscTask extends LeafTask {
Expand Down Expand Up @@ -103,6 +105,22 @@ export class TscTask extends LeafTask {
this.traceTrigger(`new file detected ${[...configFileNames.values()].join(",")}`);
return false;
}
try {
const tsVersion = await getInstalledPackageVersion(
"typescript",
this.node.pkg.directory,
);

if (tsVersion !== tsBuildInfo.version) {
this.traceTrigger("previous build error");
return false;
}
} catch (e) {
this.traceTrigger(
`Unable to get installed package version for typescript from ${this.node.pkg.directory}`,
);
return false;
}

// Check tsconfig.json
return this.checkTsConfig(tsBuildInfoFileDirectory, tsBuildInfo, config);
Expand Down Expand Up @@ -384,11 +402,16 @@ export abstract class TscDependentTask extends LeafWithDoneFileTask {
config = await readFileAsync(this.configFileFullPath, "utf8");
}

return JSON.stringify({ tsBuildInfoFiles, config });
return JSON.stringify({
version: await this.getToolVersion(),
config,
tsBuildInfoFiles,
});
} catch (e) {
this.traceExec(`error generating done file content ${e}`);
return undefined;
}
}
protected abstract get configFileFullPath(): string;
protected abstract getToolVersion(): Promise<string>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type { WorkerExecResult, WorkerMessage } from "./worker";
export async function compile(msg: WorkerMessage): Promise<WorkerExecResult> {
const { command, cwd } = msg;
// Load the typescript version that is in the cwd scope
// Load the eslint version that is in the cwd scope
const tsPath = require.resolve("typescript", { paths: [cwd] });
const ts: typeof tsLib = require(tsPath);

Expand Down
3 changes: 1 addition & 2 deletions build-tools/packages/bundle-size-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fluidframework/bundle-size-tools",
"version": "0.20.0",
"version": "0.21.0",
"description": "Utility for analyzing bundle size regressions",
"homepage": "https://fluidframework.com",
"repository": {
Expand Down Expand Up @@ -42,7 +42,6 @@
"@fluidframework/build-common": "^2.0.0",
"@fluidframework/eslint-config-fluid": "^2.0.0",
"@microsoft/api-extractor": "^7.35.3",
"@types/jszip": "^3.4.1",
"@types/msgpack-lite": "^0.1.8",
"@types/node": "^14.18.51",
"@types/pako": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion build-tools/packages/readme-command/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fluid-internal/readme-command",
"version": "0.20.0",
"version": "0.21.0",
"private": true,
"description": "CLI to generate readmes for Fluid build-tools",
"homepage": "https://fluidframework.com",
Expand Down
2 changes: 1 addition & 1 deletion build-tools/packages/version-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fluid-tools/version-tools",
"version": "0.20.0",
"version": "0.21.0",
"description": "Versioning tools for Fluid Framework",
"homepage": "https://fluidframework.com",
"repository": {
Expand Down
Loading