Node 16 fix: Import performance

This commit is contained in:
Henry Mercer 2024-10-10 19:55:07 +01:00
parent 565880b86a
commit ab636d7049
3 changed files with 5 additions and 3 deletions

5
lib/setup-codeql.js generated
View file

@ -36,6 +36,7 @@ exports.getCodeQLURLVersion = getCodeQLURLVersion;
exports.setupCodeQLBundle = setupCodeQLBundle;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const perf_hooks_1 = require("perf_hooks");
const toolcache = __importStar(require("@actions/tool-cache"));
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
const semver = __importStar(require("semver"));
@ -404,9 +405,9 @@ const downloadCodeQL = async function (codeqlURL, maybeBundleVersion, maybeCliVe
}
logger.debug("Caching CodeQL bundle.");
const toolcacheVersion = getCanonicalToolcacheVersion(maybeCliVersion, bundleVersion, logger);
const toolcacheStart = performance.now();
const toolcacheStart = perf_hooks_1.performance.now();
const toolcachedBundlePath = await toolcache.cacheDir(extractedBundlePath, "CodeQL", toolcacheVersion);
logger.info(`Added CodeQL bundle to the tool cache (${(0, logging_1.formatDuration)(performance.now() - toolcacheStart)}).`);
logger.info(`Added CodeQL bundle to the tool cache (${(0, logging_1.formatDuration)(perf_hooks_1.performance.now() - toolcacheStart)}).`);
// Defensive check: we expect `cacheDir` to copy the bundle to a new location.
if (toolcachedBundlePath !== extractedBundlePath) {
await (0, util_1.cleanUpGlob)(extractedBundlePath, "CodeQL bundle from temporary directory", logger);

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,7 @@
import * as fs from "fs";
import { OutgoingHttpHeaders } from "http";
import * as path from "path";
import { performance } from "perf_hooks";
import * as toolcache from "@actions/tool-cache";
import { default as deepEqual } from "fast-deep-equal";