mirror of
https://github.com/github/codeql-action.git
synced 2026-05-21 10:11:48 +00:00
Test zipping with zlib
This commit is contained in:
Generated
+19
-1
@@ -25,6 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.uploadDatabaseBundleDebugArtifact = exports.uploadLogsDebugArtifact = exports.uploadSarifDebugArtifact = exports.uploadDebugArtifacts = exports.sanitizeArifactName = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const zlib_1 = __importDefault(require("zlib"));
|
||||
const artifact = __importStar(require("@actions/artifact"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const adm_zip_1 = __importDefault(require("adm-zip"));
|
||||
@@ -114,10 +115,27 @@ async function uploadPartialDatabaseBundle(config, language) {
|
||||
zip.writeZip(databaseBundlePath);
|
||||
await uploadDebugArtifacts([databaseBundlePath], config.dbLocation, config.debugArtifactName);
|
||||
}
|
||||
async function uploadPartialDatabaseBundleZlib(config, language) {
|
||||
const databasePath = (0, util_1.getCodeQLDatabasePath)(config, language);
|
||||
const databaseBundlePath = path.resolve(config.dbLocation, `${config.debugDatabaseName}-${language}-partial.gz`);
|
||||
core.info(`${config.debugDatabaseName}-${language} is not finalized. Uploading partial database bundle at ${databaseBundlePath}...`);
|
||||
// See `bundleDb` for explanation behind deleting existing db bundle.
|
||||
if (fs.existsSync(databaseBundlePath)) {
|
||||
await (0, del_1.default)(databaseBundlePath, { force: true });
|
||||
}
|
||||
const gzip = zlib_1.default.createGzip();
|
||||
const outputStream = fs.createWriteStream(databaseBundlePath);
|
||||
// Write all files in database folder to gz location
|
||||
(0, util_1.listFolder)(databasePath).map((file) => {
|
||||
const readStream = fs.createReadStream(file);
|
||||
readStream.pipe(gzip).pipe(outputStream);
|
||||
});
|
||||
await uploadDebugArtifacts([databaseBundlePath], config.dbLocation, config.debugArtifactName);
|
||||
}
|
||||
async function uploadDatabaseBundleDebugArtifact(config, logger) {
|
||||
for (const language of config.languages) {
|
||||
if (!(0, analyze_1.dbIsFinalized)(config, language, logger)) {
|
||||
await uploadPartialDatabaseBundle(config, language);
|
||||
await uploadPartialDatabaseBundleZlib(config, language);
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user