mirror of
https://github.com/actions/setup-go.git
synced 2025-04-23 17:40:50 +00:00
Merge branch 'modules-caching' into modules-caching-tests
This commit is contained in:
commit
0d5a33faa6
4 changed files with 42 additions and 27 deletions
17
dist/cache-save/index.js
vendored
17
dist/cache-save/index.js
vendored
|
@ -3231,10 +3231,7 @@ const options_1 = __webpack_require__(538);
|
||||||
const requestUtils_1 = __webpack_require__(899);
|
const requestUtils_1 = __webpack_require__(899);
|
||||||
const versionSalt = '1.0';
|
const versionSalt = '1.0';
|
||||||
function getCacheApiUrl(resource) {
|
function getCacheApiUrl(resource) {
|
||||||
// Ideally we just use ACTIONS_CACHE_URL
|
const baseUrl = process.env['ACTIONS_CACHE_URL'] || '';
|
||||||
const baseUrl = (process.env['ACTIONS_CACHE_URL'] ||
|
|
||||||
process.env['ACTIONS_RUNTIME_URL'] ||
|
|
||||||
'').replace('pipelines', 'artifactcache');
|
|
||||||
if (!baseUrl) {
|
if (!baseUrl) {
|
||||||
throw new Error('Cache Service Url not found, unable to restore cache.');
|
throw new Error('Cache Service Url not found, unable to restore cache.');
|
||||||
}
|
}
|
||||||
|
@ -5658,7 +5655,8 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||||
//
|
//
|
||||||
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
|
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
|
||||||
// on 64-bit systems), split the download into multiple segments
|
// on 64-bit systems), split the download into multiple segments
|
||||||
const maxSegmentSize = buffer.constants.MAX_LENGTH;
|
// ~2 GB = 2147483647, beyond this, we start getting out of range error. So, capping it accordingly.
|
||||||
|
const maxSegmentSize = Math.min(2147483647, buffer.constants.MAX_LENGTH);
|
||||||
const downloadProgress = new DownloadProgress(contentLength);
|
const downloadProgress = new DownloadProgress(contentLength);
|
||||||
const fd = fs.openSync(archivePath, 'w');
|
const fd = fs.openSync(archivePath, 'w');
|
||||||
try {
|
try {
|
||||||
|
@ -43508,6 +43506,15 @@ function checkKey(key) {
|
||||||
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
|
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* isFeatureAvailable to check the presence of Actions cache service
|
||||||
|
*
|
||||||
|
* @returns boolean return true if Actions cache service feature is available, otherwise false
|
||||||
|
*/
|
||||||
|
function isFeatureAvailable() {
|
||||||
|
return !!process.env['ACTIONS_CACHE_URL'];
|
||||||
|
}
|
||||||
|
exports.isFeatureAvailable = isFeatureAvailable;
|
||||||
/**
|
/**
|
||||||
* Restores cache from keys
|
* Restores cache from keys
|
||||||
*
|
*
|
||||||
|
|
29
dist/setup/index.js
vendored
29
dist/setup/index.js
vendored
|
@ -3342,10 +3342,7 @@ const options_1 = __webpack_require__(538);
|
||||||
const requestUtils_1 = __webpack_require__(899);
|
const requestUtils_1 = __webpack_require__(899);
|
||||||
const versionSalt = '1.0';
|
const versionSalt = '1.0';
|
||||||
function getCacheApiUrl(resource) {
|
function getCacheApiUrl(resource) {
|
||||||
// Ideally we just use ACTIONS_CACHE_URL
|
const baseUrl = process.env['ACTIONS_CACHE_URL'] || '';
|
||||||
const baseUrl = (process.env['ACTIONS_CACHE_URL'] ||
|
|
||||||
process.env['ACTIONS_RUNTIME_URL'] ||
|
|
||||||
'').replace('pipelines', 'artifactcache');
|
|
||||||
if (!baseUrl) {
|
if (!baseUrl) {
|
||||||
throw new Error('Cache Service Url not found, unable to restore cache.');
|
throw new Error('Cache Service Url not found, unable to restore cache.');
|
||||||
}
|
}
|
||||||
|
@ -3689,6 +3686,7 @@ exports.addBinToPath = exports.run = void 0;
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const io = __importStar(__webpack_require__(1));
|
const io = __importStar(__webpack_require__(1));
|
||||||
const installer = __importStar(__webpack_require__(923));
|
const installer = __importStar(__webpack_require__(923));
|
||||||
|
const semver = __importStar(__webpack_require__(280));
|
||||||
const path_1 = __importDefault(__webpack_require__(622));
|
const path_1 = __importDefault(__webpack_require__(622));
|
||||||
const cache_restore_1 = __webpack_require__(409);
|
const cache_restore_1 = __webpack_require__(409);
|
||||||
const child_process_1 = __importDefault(__webpack_require__(129));
|
const child_process_1 = __importDefault(__webpack_require__(129));
|
||||||
|
@ -3709,9 +3707,14 @@ function run() {
|
||||||
let auth = !token || isGhes() ? undefined : `token ${token}`;
|
let auth = !token || isGhes() ? undefined : `token ${token}`;
|
||||||
const checkLatest = core.getBooleanInput('check-latest');
|
const checkLatest = core.getBooleanInput('check-latest');
|
||||||
const installDir = yield installer.getGo(versionSpec, checkLatest, auth);
|
const installDir = yield installer.getGo(versionSpec, checkLatest, auth);
|
||||||
core.exportVariable('GOROOT', installDir);
|
|
||||||
core.addPath(path_1.default.join(installDir, 'bin'));
|
core.addPath(path_1.default.join(installDir, 'bin'));
|
||||||
core.info('Added go to the path');
|
core.info('Added go to the path');
|
||||||
|
const version = installer.makeSemver(versionSpec);
|
||||||
|
// Go versions less than 1.9 require GOROOT to be set
|
||||||
|
if (semver.lt(version, '1.9.0')) {
|
||||||
|
core.info('Setting GOROOT for Go version < 1.9');
|
||||||
|
core.exportVariable('GOROOT', installDir);
|
||||||
|
}
|
||||||
let added = yield addBinToPath();
|
let added = yield addBinToPath();
|
||||||
core.debug(`add bin ${added}`);
|
core.debug(`add bin ${added}`);
|
||||||
core.info(`Successfully setup go version ${versionSpec}`);
|
core.info(`Successfully setup go version ${versionSpec}`);
|
||||||
|
@ -3758,12 +3761,12 @@ function addBinToPath() {
|
||||||
if (!fs_1.default.existsSync(gp)) {
|
if (!fs_1.default.existsSync(gp)) {
|
||||||
// some of the hosted images have go install but not profile dir
|
// some of the hosted images have go install but not profile dir
|
||||||
core.debug(`creating ${gp}`);
|
core.debug(`creating ${gp}`);
|
||||||
io.mkdirP(gp);
|
yield io.mkdirP(gp);
|
||||||
}
|
}
|
||||||
let bp = path_1.default.join(gp, 'bin');
|
let bp = path_1.default.join(gp, 'bin');
|
||||||
if (!fs_1.default.existsSync(bp)) {
|
if (!fs_1.default.existsSync(bp)) {
|
||||||
core.debug(`creating ${bp}`);
|
core.debug(`creating ${bp}`);
|
||||||
io.mkdirP(bp);
|
yield io.mkdirP(bp);
|
||||||
}
|
}
|
||||||
core.addPath(bp);
|
core.addPath(bp);
|
||||||
added = true;
|
added = true;
|
||||||
|
@ -6079,7 +6082,8 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||||
//
|
//
|
||||||
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
|
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
|
||||||
// on 64-bit systems), split the download into multiple segments
|
// on 64-bit systems), split the download into multiple segments
|
||||||
const maxSegmentSize = buffer.constants.MAX_LENGTH;
|
// ~2 GB = 2147483647, beyond this, we start getting out of range error. So, capping it accordingly.
|
||||||
|
const maxSegmentSize = Math.min(2147483647, buffer.constants.MAX_LENGTH);
|
||||||
const downloadProgress = new DownloadProgress(contentLength);
|
const downloadProgress = new DownloadProgress(contentLength);
|
||||||
const fd = fs.openSync(archivePath, 'w');
|
const fd = fs.openSync(archivePath, 'w');
|
||||||
try {
|
try {
|
||||||
|
@ -45171,6 +45175,15 @@ function checkKey(key) {
|
||||||
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
|
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* isFeatureAvailable to check the presence of Actions cache service
|
||||||
|
*
|
||||||
|
* @returns boolean return true if Actions cache service feature is available, otherwise false
|
||||||
|
*/
|
||||||
|
function isFeatureAvailable() {
|
||||||
|
return !!process.env['ACTIONS_CACHE_URL'];
|
||||||
|
}
|
||||||
|
exports.isFeatureAvailable = isFeatureAvailable;
|
||||||
/**
|
/**
|
||||||
* Restores cache from keys
|
* Restores cache from keys
|
||||||
*
|
*
|
||||||
|
|
19
package-lock.json
generated
19
package-lock.json
generated
|
@ -9,7 +9,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^1.0.8",
|
"@actions/cache": "^2.0.0",
|
||||||
"@actions/core": "^1.6.0",
|
"@actions/core": "^1.6.0",
|
||||||
"@actions/exec": "^1.1.0",
|
"@actions/exec": "^1.1.0",
|
||||||
"@actions/glob": "^0.2.0",
|
"@actions/glob": "^0.2.0",
|
||||||
|
@ -32,9 +32,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache": {
|
"node_modules/@actions/cache": {
|
||||||
"version": "1.0.9",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-2.0.0.tgz",
|
||||||
"integrity": "sha512-VzqeDyW3kIDdARNQphd1FrzZCiJRuv98aXwM3R+BLe2UvdZXdRqjC/rrytSm4Nv4OJuI8NA1pbhkXIf+a4LFtw==",
|
"integrity": "sha512-d7n8ul6HjWX6oDrNEPoqn8ZvqyyDhp9Uek6WOxALyxGVsXU+8+ND+viD3UfrXVWfs/GQiqI5Eq4cOozZj0yRFQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
|
@ -4897,9 +4897,9 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": {
|
"@actions/cache": {
|
||||||
"version": "1.0.9",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-2.0.0.tgz",
|
||||||
"integrity": "sha512-VzqeDyW3kIDdARNQphd1FrzZCiJRuv98aXwM3R+BLe2UvdZXdRqjC/rrytSm4Nv4OJuI8NA1pbhkXIf+a4LFtw==",
|
"integrity": "sha512-d7n8ul6HjWX6oDrNEPoqn8ZvqyyDhp9Uek6WOxALyxGVsXU+8+ND+viD3UfrXVWfs/GQiqI5Eq4cOozZj0yRFQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
|
@ -8414,11 +8414,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tslib": {
|
|
||||||
"version": "1.14.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
|
|
||||||
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
|
|
||||||
},
|
|
||||||
"tunnel": {
|
"tunnel": {
|
||||||
"version": "0.0.6",
|
"version": "0.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"description": "setup go action",
|
"description": "setup go action",
|
||||||
"main": "lib/setup-go.js",
|
"main": "lib/setup-go.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build -o dist/setup src/setup-go.ts && ncc build -o dist/cache-save src/cache-save.ts",
|
"build": "tsc && ncc build -o dist/setup src/setup-go.ts && ncc build -o dist/cache-save src/cache-save.ts",
|
||||||
"format": "prettier --write **/*.ts",
|
"format": "prettier --write **/*.ts",
|
||||||
"format-check": "prettier --check **/*.ts",
|
"format-check": "prettier --check **/*.ts",
|
||||||
"test": "jest --coverage",
|
"test": "jest --coverage",
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^1.0.8",
|
"@actions/cache": "^2.0.0",
|
||||||
"@actions/core": "^1.6.0",
|
"@actions/core": "^1.6.0",
|
||||||
"@actions/exec": "^1.1.0",
|
"@actions/exec": "^1.1.0",
|
||||||
"@actions/glob": "^0.2.0",
|
"@actions/glob": "^0.2.0",
|
||||||
|
|
Loading…
Add table
Reference in a new issue