Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Commit

Permalink
feat: add compression method log
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylvln committed Jan 18, 2022
1 parent 3135027 commit 80f64ef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ async function main() {
destination: tmpFile.path,
});

console.log('🗜️ Extracting cache archive...');
await extractTar(tmpFile.path, workspace);
await core.group('🗜️ Extracting cache archive...', () =>
extractTar(tmpFile.path, workspace),
);

saveState({
cacheHitKind: bestMatchKind,
Expand Down
6 changes: 4 additions & 2 deletions src/post.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as core from '@actions/core';
import * as github from '@actions/github';
import * as glob from '@actions/glob';
import { Storage } from '@google-cloud/storage';
Expand Down Expand Up @@ -42,8 +43,9 @@ async function main() {
.then((files) => files.map((file) => path.relative(workspace, file)));

return withTemporaryFile(async (tmpFile) => {
console.log('🗜️ Creating cache archive...');
await createTar(tmpFile.path, paths, workspace);
await core.group('🗜️ Creating cache archive...', () =>
createTar(tmpFile.path, paths, workspace),
);

console.log('🌐 Uploading cache archive to bucket...');
await bucket.upload(tmpFile.path, {
Expand Down
8 changes: 5 additions & 3 deletions src/tar-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import * as exec from '@actions/exec';
import * as semver from 'semver';

enum CompressionMethod {
GZIP,
ZSTD_WITHOUT_LONG,
ZSTD,
GZIP = 'gzip',
ZSTD_WITHOUT_LONG = 'zstd (without long)',
ZSTD = 'zstd',
}

async function getTarCompressionMethod(): Promise<CompressionMethod> {
Expand Down Expand Up @@ -37,6 +37,7 @@ export async function createTar(
cwd: string,
): Promise<number> {
const compressionMethod = await getTarCompressionMethod();
console.log(`🔹 Using '${compressionMethod}' compression method.`);

const compressionArgs =
compressionMethod === CompressionMethod.GZIP
Expand All @@ -62,6 +63,7 @@ export async function extractTar(
cwd: string,
): Promise<number> {
const compressionMethod = await getTarCompressionMethod();
console.log(`🔹 Using '${compressionMethod}' compression method.`);

const compressionArgs =
compressionMethod === CompressionMethod.GZIP
Expand Down

0 comments on commit 80f64ef

Please sign in to comment.