add timer logs to prepackage

This commit is contained in:
Patrick Erichsen 2025-07-28 21:11:40 -07:00
parent 094c8bb6bf
commit bbb1cda07c
3 changed files with 23 additions and 3 deletions

View file

@ -307,6 +307,7 @@ jobs:
vscode-package-extension-macos:
runs-on: macos-13
timeout-minutes: 15
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
@ -512,3 +513,5 @@ jobs:
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
## Currently we only use `vscode-package-extension-macos` for publishing build artifacts for `oneper` script
allowed-failures: vscode-package-extension-macos

View file

@ -19,8 +19,8 @@ if (!fs.existsSync("build")) {
const isPreRelease = args.includes("--pre-release");
let command = isPreRelease
? "npx @vscode/vsce package --out ./build --pre-release --no-dependencies --no-pre-publish" // --yarn"
: "npx @vscode/vsce package --out ./build --no-dependencies --no-pre-publish"; // --yarn";
? "npx @vscode/vsce package --out ./build --pre-release --no-dependencies" // --yarn"
: "npx @vscode/vsce package --out ./build --no-dependencies"; // --yarn";
if (target) {
command += ` --target ${target}`;

View file

@ -67,19 +67,26 @@ const isLinuxTarget = target?.startsWith("linux");
const isMacTarget = target?.startsWith("darwin");
void (async () => {
console.log("[info] Packaging extension for target ", target);
const startTime = Date.now();
console.log(`[info] Packaging extension for target ${target} - started at ${new Date().toISOString()}`);
// Make sure we have an initial timestamp file
writeBuildTimestamp();
if (!skipInstalls) {
const installStart = Date.now();
console.log(`[timer] Starting npm installs at ${new Date().toISOString()}`);
await Promise.all([generateAndCopyConfigYamlSchema(), npmInstall()]);
console.log(`[timer] npm installs completed in ${Date.now() - installStart}ms`);
}
process.chdir(path.join(continueDir, "gui"));
if (isInGitHubAction) {
const guiBuildStart = Date.now();
console.log(`[timer] Starting GUI build at ${new Date().toISOString()}`);
execCmdSync("npm run build");
console.log(`[timer] GUI build completed in ${Date.now() - guiBuildStart}ms`);
}
// Copy over the dist folder to the JetBrains extension //
@ -98,6 +105,8 @@ void (async () => {
rimrafSync(intellijExtensionWebviewPath);
fs.mkdirSync(intellijExtensionWebviewPath, { recursive: true });
const jetbrainsCopyStart = Date.now();
console.log(`[timer] Starting JetBrains copy at ${new Date().toISOString()}`);
await new Promise((resolve, reject) => {
ncp("dist", intellijExtensionWebviewPath, (error) => {
if (error) {
@ -110,6 +119,7 @@ void (async () => {
resolve();
});
});
console.log(`[timer] JetBrains copy completed in ${Date.now() - jetbrainsCopyStart}ms`);
// Put back index.html
if (fs.existsSync(indexHtmlPath)) {
@ -123,6 +133,8 @@ void (async () => {
// Then copy over the dist folder to the VSCode extension //
const vscodeGuiPath = path.join("../extensions/vscode/gui");
fs.mkdirSync(vscodeGuiPath, { recursive: true });
const vscodeCopyStart = Date.now();
console.log(`[timer] Starting VSCode copy at ${new Date().toISOString()}`);
await new Promise((resolve, reject) => {
ncp("dist", vscodeGuiPath, (error) => {
if (error) {
@ -137,6 +149,7 @@ void (async () => {
}
});
});
console.log(`[timer] VSCode copy completed in ${Date.now() - vscodeCopyStart}ms`);
if (!fs.existsSync(path.join("dist", "assets", "index.js"))) {
throw new Error("gui build did not produce index.js");
@ -151,6 +164,8 @@ void (async () => {
fs.mkdirSync("bin", { recursive: true });
// onnxruntime-node
const onnxCopyStart = Date.now();
console.log(`[timer] Starting onnxruntime copy at ${new Date().toISOString()}`);
await new Promise((resolve, reject) => {
ncp(
path.join(__dirname, "../../../core/node_modules/onnxruntime-node/bin"),
@ -167,6 +182,7 @@ void (async () => {
},
);
});
console.log(`[timer] onnxruntime copy completed in ${Date.now() - onnxCopyStart}ms`);
if (target) {
// If building for production, only need the binaries for current platform
try {
@ -433,5 +449,6 @@ void (async () => {
`out/node_modules/esbuild/lib/main.js`,
]);
console.log(`[timer] Prepackage completed in ${Date.now() - startTime}ms - finished at ${new Date().toISOString()}`);
process.exit(0);
})();