Fix TRAP directory location
This commit is contained in:
parent
5b4b44c9d6
commit
b42a495e8a
3 changed files with 37 additions and 16 deletions
20
lib/analyze-action.js
generated
20
lib/analyze-action.js
generated
|
|
@ -18,10 +18,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.runPromise = exports.sendStatusReport = void 0;
|
exports.runPromise = exports.sendStatusReport = void 0;
|
||||||
// We need to import `performance` on Node 12
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
|
const path_1 = __importDefault(require("path"));
|
||||||
|
// We need to import `performance` on Node 12
|
||||||
const perf_hooks_1 = require("perf_hooks");
|
const perf_hooks_1 = require("perf_hooks");
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const actionsUtil = __importStar(require("./actions-util"));
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
|
|
@ -72,14 +76,22 @@ function hasBadExpectErrorInput() {
|
||||||
!util.isInTestMode());
|
!util.isInTestMode());
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns whether any `.trap[.gz]` files exist under the `db-go` folder,
|
* Returns whether any TRAP files exist under the `db-go` folder,
|
||||||
* indicating whether Go extraction has extracted at least one file.
|
* indicating whether Go extraction has extracted at least one file.
|
||||||
*/
|
*/
|
||||||
function doesGoExtractionOutputExist(config) {
|
function doesGoExtractionOutputExist(config) {
|
||||||
const golangDbDirectory = util.getCodeQLDatabasePath(config, languages_1.Language.go);
|
const golangDbDirectory = util.getCodeQLDatabasePath(config, languages_1.Language.go);
|
||||||
|
const trapDirectory = path_1.default.join(golangDbDirectory, "trap", languages_1.Language.go);
|
||||||
return fs
|
return fs
|
||||||
.readdirSync(golangDbDirectory)
|
.readdirSync(trapDirectory)
|
||||||
.some((fileName) => fileName.endsWith(".trap") || fileName.endsWith(".trap.gz"));
|
.some((fileName) => [
|
||||||
|
".trap",
|
||||||
|
".trap.gz",
|
||||||
|
".trap.br",
|
||||||
|
".trap.tar.gz",
|
||||||
|
".trap.tar.br",
|
||||||
|
".trap.tar",
|
||||||
|
].some((ext) => fileName.endsWith(ext)));
|
||||||
}
|
}
|
||||||
async function run() {
|
async function run() {
|
||||||
const startedAt = new Date();
|
const startedAt = new Date();
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,6 @@
|
||||||
// We need to import `performance` on Node 12
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
|
import path from "path";
|
||||||
|
// We need to import `performance` on Node 12
|
||||||
import { performance } from "perf_hooks";
|
import { performance } from "perf_hooks";
|
||||||
|
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
|
|
@ -32,12 +33,12 @@ const pkg = require("../package.json");
|
||||||
|
|
||||||
interface AnalysisStatusReport
|
interface AnalysisStatusReport
|
||||||
extends upload_lib.UploadStatusReport,
|
extends upload_lib.UploadStatusReport,
|
||||||
QueriesStatusReport { }
|
QueriesStatusReport {}
|
||||||
|
|
||||||
interface FinishStatusReport
|
interface FinishStatusReport
|
||||||
extends actionsUtil.StatusReportBase,
|
extends actionsUtil.StatusReportBase,
|
||||||
actionsUtil.DatabaseCreationTimings,
|
actionsUtil.DatabaseCreationTimings,
|
||||||
AnalysisStatusReport { }
|
AnalysisStatusReport {}
|
||||||
|
|
||||||
interface FinishWithTrapUploadStatusReport extends FinishStatusReport {
|
interface FinishWithTrapUploadStatusReport extends FinishStatusReport {
|
||||||
/** Size of TRAP caches that we uploaded, in bytes. */
|
/** Size of TRAP caches that we uploaded, in bytes. */
|
||||||
|
|
@ -71,9 +72,9 @@ export async function sendStatusReport(
|
||||||
...statusReportBase,
|
...statusReportBase,
|
||||||
...(config
|
...(config
|
||||||
? {
|
? {
|
||||||
ml_powered_javascript_queries:
|
ml_powered_javascript_queries:
|
||||||
util.getMlPoweredJsQueriesStatus(config),
|
util.getMlPoweredJsQueriesStatus(config),
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
...(stats || {}),
|
...(stats || {}),
|
||||||
...(dbCreationTimings || {}),
|
...(dbCreationTimings || {}),
|
||||||
|
|
@ -101,15 +102,23 @@ function hasBadExpectErrorInput(): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether any `.trap[.gz]` files exist under the `db-go` folder,
|
* Returns whether any TRAP files exist under the `db-go` folder,
|
||||||
* indicating whether Go extraction has extracted at least one file.
|
* indicating whether Go extraction has extracted at least one file.
|
||||||
*/
|
*/
|
||||||
function doesGoExtractionOutputExist(config: Config): boolean {
|
function doesGoExtractionOutputExist(config: Config): boolean {
|
||||||
const golangDbDirectory = util.getCodeQLDatabasePath(config, Language.go);
|
const golangDbDirectory = util.getCodeQLDatabasePath(config, Language.go);
|
||||||
|
const trapDirectory = path.join(golangDbDirectory, "trap", Language.go);
|
||||||
return fs
|
return fs
|
||||||
.readdirSync(golangDbDirectory)
|
.readdirSync(trapDirectory)
|
||||||
.some(
|
.some((fileName) =>
|
||||||
(fileName) => fileName.endsWith(".trap") || fileName.endsWith(".trap.gz")
|
[
|
||||||
|
".trap",
|
||||||
|
".trap.gz",
|
||||||
|
".trap.br",
|
||||||
|
".trap.tar.gz",
|
||||||
|
".trap.tar.br",
|
||||||
|
".trap.tar",
|
||||||
|
].some((ext) => fileName.endsWith(ext))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue