Skip to content

Commit

Permalink
Add all sorts of logging
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Jan 16, 2024
1 parent 62ca885 commit c82b38e
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 13 deletions.
10 changes: 7 additions & 3 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93648,6 +93648,7 @@ class GradleStateCache {
core.info(`Caching ${this.cacheDescription} with cache key: ${cacheKey}`);
const cachePath = this.getCachePath();
yield (0, cache_utils_1.saveCache)(cachePath, cacheKey, gradleHomeEntryListener);
core.info('Completed saveCache()');
return;
});
}
Expand Down Expand Up @@ -94547,7 +94548,9 @@ exports.restoreCache = restoreCache;
function saveCache(cachePath, cacheKey, listener) {
return __awaiter(this, void 0, void 0, function* () {
try {
core.info('About to call cache.saveCache()');
const savedEntry = yield cache.saveCache(cachePath, cacheKey);
core.info('Completed cache.saveCache()');
listener.markSaved(savedEntry.key, savedEntry.size);
}
catch (error) {
Expand Down Expand Up @@ -94746,9 +94749,10 @@ function save(gradleUserHome, cacheListener, daemonController) {
core.warning(`Cache cleanup failed. Will continue. ${String(e)}`);
}
}
yield core.group('Caching Gradle state', () => __awaiter(this, void 0, void 0, function* () {
return new cache_base_1.GradleStateCache(gradleUserHome).save(cacheListener);
}));
core.startGroup('Caching Gradle state');
yield new cache_base_1.GradleStateCache(gradleUserHome).save(cacheListener);
core.endGroup();
core.info('Completed save cache');
});
}
exports.save = save;
Expand Down
2 changes: 1 addition & 1 deletion dist/main/index.js.map

Large diffs are not rendered by default.

27 changes: 23 additions & 4 deletions dist/post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93648,6 +93648,7 @@ class GradleStateCache {
core.info(`Caching ${this.cacheDescription} with cache key: ${cacheKey}`);
const cachePath = this.getCachePath();
yield (0, cache_utils_1.saveCache)(cachePath, cacheKey, gradleHomeEntryListener);
core.info('Completed saveCache()');
return;
});
}
Expand Down Expand Up @@ -94547,7 +94548,9 @@ exports.restoreCache = restoreCache;
function saveCache(cachePath, cacheKey, listener) {
return __awaiter(this, void 0, void 0, function* () {
try {
core.info('About to call cache.saveCache()');
const savedEntry = yield cache.saveCache(cachePath, cacheKey);
core.info('Completed cache.saveCache()');
listener.markSaved(savedEntry.key, savedEntry.size);
}
catch (error) {
Expand Down Expand Up @@ -94746,9 +94749,10 @@ function save(gradleUserHome, cacheListener, daemonController) {
core.warning(`Cache cleanup failed. Will continue. ${String(e)}`);
}
}
yield core.group('Caching Gradle state', () => __awaiter(this, void 0, void 0, function* () {
return new cache_base_1.GradleStateCache(gradleUserHome).save(cacheListener);
}));
core.startGroup('Caching Gradle state');
yield new cache_base_1.GradleStateCache(gradleUserHome).save(cacheListener);
core.endGroup();
core.info('Completed save cache');
});
}
exports.save = save;
Expand Down Expand Up @@ -95401,6 +95405,22 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = void 0;
const core = __importStar(__nccwpck_require__(2186));
const setupGradle = __importStar(__nccwpck_require__(8652));
const async_hooks = __importStar(__nccwpck_require__(852));
const asyncHook = async_hooks.createHook({
init(asyncId, type, _triggerAsyncId, _resource) {
core.info(`Async operation started: asyncId ${asyncId}, type ${type}`);
},
before(asyncId) {
core.info(`Before async operation: asyncId ${asyncId}`);
},
after(asyncId) {
core.info(`After async operation: asyncId ${asyncId}`);
},
destroy(asyncId) {
core.info(`Async operation destroyed: asyncId ${asyncId}`);
}
});
asyncHook.enable();
process.on('uncaughtException', e => handleFailure(e));
function run() {
return __awaiter(this, void 0, void 0, function* () {
Expand All @@ -95421,7 +95441,6 @@ function handleFailure(error) {
}
}
run();
core.info('Finished post run()');


/***/ }),
Expand Down
2 changes: 1 addition & 1 deletion dist/post/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/cache-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ export class GradleStateCache {
const cachePath = this.getCachePath()
await saveCache(cachePath, cacheKey, gradleHomeEntryListener)

core.info('Completed saveCache()')

return
}

Expand Down
2 changes: 2 additions & 0 deletions src/cache-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ export async function restoreCache(

export async function saveCache(cachePath: string[], cacheKey: string, listener: CacheEntryListener): Promise<void> {
try {
core.info('About to call cache.saveCache()')
const savedEntry = await cache.saveCache(cachePath, cacheKey)
core.info('Completed cache.saveCache()')
listener.markSaved(savedEntry.key, savedEntry.size)
} catch (error) {
if (error instanceof cache.ReserveCacheError) {
Expand Down
8 changes: 5 additions & 3 deletions src/caches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ export async function save(
}
}

await core.group('Caching Gradle state', async () => {
return new GradleStateCache(gradleUserHome).save(cacheListener)
})
core.startGroup('Caching Gradle state')
await new GradleStateCache(gradleUserHome).save(cacheListener)
core.endGroup()

core.info('Completed save cache')
}
19 changes: 18 additions & 1 deletion src/post.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
import * as core from '@actions/core'
import * as setupGradle from './setup-gradle'
import * as async_hooks from 'async_hooks'

const asyncHook = async_hooks.createHook({
init(asyncId, type, _triggerAsyncId, _resource) {
core.info(`Async operation started: asyncId ${asyncId}, type ${type}`)
},
before(asyncId) {
core.info(`Before async operation: asyncId ${asyncId}`)
},
after(asyncId) {
core.info(`After async operation: asyncId ${asyncId}`)
},
destroy(asyncId) {
core.info(`Async operation destroyed: asyncId ${asyncId}`)
}
})

asyncHook.enable()

// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
Expand All @@ -26,4 +44,3 @@ function handleFailure(error: unknown): void {
}

run()
core.info('Finished post run()')

0 comments on commit c82b38e

Please sign in to comment.