Skip to content

Commit a76c8ff

Browse files
authored
Update to Node 24, default to skipping the cache (#350)
1 parent 5f004e9 commit a76c8ff

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
"main": "dist/index.js",
77
"types": "dist/index.d.js",
88
"engines": {
9-
"node": ">= 20.x",
10-
"npm": ">= 10.x"
9+
"node": ">= 24.x",
10+
"npm": ">= 11.x"
1111
},
1212
"scripts": {
1313
"build": "rm -rf dist/ && ncc build --source-map --no-source-map-register src/index.ts",
1414
"lint": "eslint .",
1515
"format": "eslint --fix",
1616
"docs": "rm -rf docs/ && typedoc --plugin typedoc-plugin-markdown",
17-
"test": "node --require ts-node/register --test-reporter spec --test tests/download-util.test.ts tests/format-url.test.ts tests/index.test.ts"
17+
"test": "node --require ts-node/register --test-reporter spec --test tests/**/*.test.ts"
1818
},
1919
"files": [
2020
"dist/**/*"
@@ -35,7 +35,7 @@
3535
"@actions/exec": "^1.1.1",
3636
"@actions/http-client": "^2.2.3",
3737
"@actions/tool-cache": "^2.0.2",
38-
"@google-github-actions/actions-utils": "^0.8.9",
38+
"@google-github-actions/actions-utils": "^1.0.0",
3939
"semver": "^7.7.2"
4040
},
4141
"devDependencies": {

src/index.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ export async function isAuthenticated(): Promise<boolean> {
165165
* specification is installed.
166166
* @returns The path of the installed tool.
167167
*/
168-
export async function installGcloudSDK(version: string, skipToolCache?: boolean): Promise<string> {
168+
export async function installGcloudSDK(
169+
version: string,
170+
useToolCache: boolean = false,
171+
): Promise<string> {
169172
// Retrieve the release corresponding to the specified version and OS
170173
const osPlat = os.platform();
171174
const osArch = os.arch();
@@ -181,22 +184,23 @@ export async function installGcloudSDK(version: string, skipToolCache?: boolean)
181184
}
182185

183186
// Either cache the tool or just add it directly to the path.
184-
if (skipToolCache) {
185-
// Caching the tool on disk takes a really long time, and it's not clear
186-
// whether it's even valuable since it's ONLY cached on disk on the runner.
187-
// For GitHub-managed runners, that is useless since they are ephemeral.
188-
//
189-
// See https://github.com/google-github-actions/setup-gcloud/issues/701 for
190-
// discussion, but it's actually faster to skip the caching and just add the
191-
// tool directly to the path.
192-
const toolRoot = path.join(extPath, 'google-cloud-sdk');
193-
core.addPath(path.join(toolRoot, 'bin'));
194-
return toolRoot;
195-
} else {
187+
//
188+
// Caching the tool on disk takes a really long time, and it's not clear
189+
// whether it's even valuable since it's ONLY cached on disk on the runner.
190+
// For GitHub-managed runners, that is useless since they are ephemeral.
191+
//
192+
// See https://github.com/google-github-actions/setup-gcloud/issues/701 for
193+
// discussion, but it's actually faster to skip the caching and just add the
194+
// tool directly to the path.
195+
if (useToolCache) {
196196
const toolRoot = path.join(extPath, 'google-cloud-sdk');
197197
const cachedToolRoot = await toolCache.cacheDir(toolRoot, 'gcloud', resolvedVersion, osArch);
198198
core.addPath(path.join(cachedToolRoot, 'bin'));
199199
return cachedToolRoot;
200+
} else {
201+
const toolRoot = path.join(extPath, 'google-cloud-sdk');
202+
core.addPath(path.join(toolRoot, 'bin'));
203+
return toolRoot;
200204
}
201205
}
202206

tests/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ test('#setupCloudSDK', { concurrency: true }, async (suite) => {
6767
t.before(async () => {
6868
await TestToolCache.start();
6969
const version = await setupCloudSDK.getLatestGcloudSDKVersion();
70-
await setupCloudSDK.installGcloudSDK(version);
70+
await setupCloudSDK.installGcloudSDK(version, true);
7171
});
7272

7373
t.beforeEach(async () => {

0 commit comments

Comments
 (0)