From 0c9da3d1283fe5ee88d7b7047c5b1596c905052b Mon Sep 17 00:00:00 2001 From: rumblefrog Date: Fri, 15 Nov 2019 05:13:26 -0500 Subject: [PATCH] debug: installer --- lib/index.js | 2 +- lib/installer.js | 3 +++ src/index.ts | 2 +- src/installer.ts | 8 +++++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/index.js b/lib/index.js index c59cd60..a553e64 100644 --- a/lib/index.js +++ b/lib/index.js @@ -21,7 +21,7 @@ const installer_1 = require("./installer"); function run() { return __awaiter(this, void 0, void 0, function* () { try { - const range = core.getInput('version'); + const range = core.getInput('version', { required: true }); let version = yield installer_1.installCompiler(range); core.setOutput('version', version); } diff --git a/lib/installer.js b/lib/installer.js index f951e82..9043486 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -26,6 +26,7 @@ function installCompiler(range) { if (!cache) { cache = yield downloadCompiler(version); } + core_1.debug(`${cache} was added to path`); core_1.addPath(cache); return version; }); @@ -34,6 +35,7 @@ exports.installCompiler = installCompiler; function downloadCompiler(version) { return __awaiter(this, void 0, void 0, function* () { const spPath = yield tool_cache_1.downloadTool(versions[version].toEndpoint()); + core_1.debug(`${versions[version].toEndpoint()} was downloaded`); let extracted; if (process.platform === 'linux') { extracted = yield tool_cache_1.extractTar(spPath); @@ -42,6 +44,7 @@ function downloadCompiler(version) { extracted = yield tool_cache_1.extractZip(spPath); } let spRoot = path_1.join(extracted, 'addons', 'sourcemod', 'scripting'); + core_1.debug(`${spRoot} was added to tool cache`); return yield tool_cache_1.cacheDir(spRoot, 'sourcepawn', version); }); } diff --git a/src/index.ts b/src/index.ts index a79ff46..f6c679a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import { installCompiler } from './installer'; async function run() { try { - const range = core.getInput('version'); + const range = core.getInput('version', { required: true }); let version = await installCompiler(range); core.setOutput('version', version); diff --git a/src/installer.ts b/src/installer.ts index 7239e13..0fdccc5 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -1,5 +1,5 @@ import { find as findCache, downloadTool, extractTar, extractZip, cacheDir } from '@actions/tool-cache'; -import { addPath } from '@actions/core'; +import { addPath, debug } from '@actions/core'; import { maxSatisfying } from 'semver'; import { join as pathJoin } from 'path'; import { getVersions } from './scraper'; @@ -21,6 +21,8 @@ export async function installCompiler(range: string): Promise { cache = await downloadCompiler(version); } + debug(`${cache} was added to path`); + addPath(cache); return version; @@ -28,6 +30,8 @@ export async function installCompiler(range: string): Promise { async function downloadCompiler(version: string) { const spPath = await downloadTool(versions[version].toEndpoint()); + + debug(`${versions[version].toEndpoint()} was downloaded`); let extracted; @@ -39,5 +43,7 @@ async function downloadCompiler(version: string) { let spRoot = pathJoin(extracted, 'addons', 'sourcemod', 'scripting'); + debug(`${spRoot} was added to tool cache`); + return await cacheDir(spRoot, 'sourcepawn', version); } \ No newline at end of file