Add unit tests

This commit is contained in:
Sergey Dolin 2023-08-18 09:01:34 +02:00
parent 6f72b31c94
commit deaf43692d
7 changed files with 114 additions and 78 deletions

46
dist/setup/index.js vendored
View file

@ -61265,11 +61265,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = void 0;
exports.getCacheInput = exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = void 0;
const cache = __importStar(__nccwpck_require__(7799));
const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514));
const package_managers_1 = __nccwpck_require__(6663);
const utils_1 = __nccwpck_require__(1314);
const getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
if (exitCode) {
@ -61324,6 +61325,13 @@ function isCacheFeatureAvailable() {
return false;
}
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
const getCacheInput = () => {
// for self-hosted environment turn off cache by default
if (utils_1.isSelfHosted() && core.getInput('cache') === '')
return false;
return core.getBooleanInput('cache');
};
exports.getCacheInput = getCacheInput;
/***/ }),
@ -61776,7 +61784,6 @@ const cache_utils_1 = __nccwpck_require__(1678);
const child_process_1 = __importDefault(__nccwpck_require__(2081));
const fs_1 = __importDefault(__nccwpck_require__(7147));
const os_1 = __importDefault(__nccwpck_require__(2037));
const utils_1 = __nccwpck_require__(1314);
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
@ -61785,7 +61792,7 @@ function run() {
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
//
const versionSpec = resolveVersionInput();
const cache = utils_1.getCacheInput();
const cache = cache_utils_1.getCacheInput();
core.info(`Setup go version spec ${versionSpec}`);
let arch = core.getInput('architecture');
if (!arch) {
@ -61966,47 +61973,20 @@ exports.getArch = getArch;
/***/ }),
/***/ 1314:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
/***/ ((__unused_webpack_module, exports) => {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getCacheInput = exports.isSelfHosted = exports.StableReleaseAlias = void 0;
const core = __importStar(__nccwpck_require__(2186));
exports.isSelfHosted = exports.StableReleaseAlias = void 0;
var StableReleaseAlias;
(function (StableReleaseAlias) {
StableReleaseAlias["Stable"] = "stable";
StableReleaseAlias["OldStable"] = "oldstable";
})(StableReleaseAlias = exports.StableReleaseAlias || (exports.StableReleaseAlias = {}));
const isSelfHosted = () => process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' &&
process.env['AGENT_ISSELFHOSTED'] === '1';
process.env['AGENT_ISSELFHOSTED'] !== '0';
exports.isSelfHosted = isSelfHosted;
const getCacheInput = () => {
// for self-hosted environment turn off cache by default
if (exports.isSelfHosted() && core.getInput('cache') === '')
return false;
return core.getBooleanInput('cache');
};
exports.getCacheInput = getCacheInput;
/***/ }),