From ec07be593a0ada7481d541782666767f2180ccfc Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Tue, 14 Dec 2021 13:12:54 -0500 Subject: [PATCH 01/13] Add test for export of GOROOT to env var Signed-off-by: Manuel Mendez --- __tests__/setup-go.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/__tests__/setup-go.test.ts b/__tests__/setup-go.test.ts index ba54900..6be0c03 100644 --- a/__tests__/setup-go.test.ts +++ b/__tests__/setup-go.test.ts @@ -49,6 +49,7 @@ describe('setup-go', () => { inSpy.mockImplementation(name => inputs[name]); getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); getBooleanInputSpy.mockImplementation(name => inputs[name]); + exSpy = jest.spyOn(core, 'exportVariable'); // node os = {}; @@ -230,6 +231,22 @@ describe('setup-go', () => { expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`); }); + it('exports GOROOT', async () => { + inputs['go-version'] = '1.13.0'; + inSpy.mockImplementation(name => inputs[name]); + + let toolPath = path.normalize('/cache/go/1.13.0/x64'); + findSpy.mockImplementation(() => toolPath); + + let vars = {} as any; + exSpy.mockImplementation(async (name, val) => { + vars[name] = val; + }); + + await main.run(); + expect(vars).toBe({GOROOT: 'foo'}); + }); + it('finds a version of go already in the cache', async () => { inputs['go-version'] = '1.13.0'; From 24c791c06c02e28cf6a442bf8722baa6b084000e Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 10 Mar 2022 13:29:40 -0500 Subject: [PATCH 02/13] Update CODEOWNERS to actions-service --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 49631c2..9ec45a5 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -* @actions/spark +* @actions/actions-service From 83124a14b6a7860a85fe88a6cd82b86f05fb2cf9 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Tue, 14 Dec 2021 13:24:18 -0500 Subject: [PATCH 03/13] Do not export GOROOT This has not been necessary since [Go 1.9](https://go.dev/doc/go1.9#goroot) at least (although clunky to do so then) but definitely not since [Go 1.10](https://go.dev/doc/go1.10#goroot). This is cargo culting code that is more than 2 years out of date and runs into issues when multiple go versions are used in an action run. Signed-off-by: Manuel Mendez --- __tests__/setup-go.test.ts | 4 ++-- dist/index.js | 1 - src/main.ts | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/__tests__/setup-go.test.ts b/__tests__/setup-go.test.ts index 6be0c03..7bb3828 100644 --- a/__tests__/setup-go.test.ts +++ b/__tests__/setup-go.test.ts @@ -231,7 +231,7 @@ describe('setup-go', () => { expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`); }); - it('exports GOROOT', async () => { + it('does not export any varibles', async () => { inputs['go-version'] = '1.13.0'; inSpy.mockImplementation(name => inputs[name]); @@ -244,7 +244,7 @@ describe('setup-go', () => { }); await main.run(); - expect(vars).toBe({GOROOT: 'foo'}); + expect(vars).toStrictEqual({}); }); it('finds a version of go already in the cache', async () => { diff --git a/dist/index.js b/dist/index.js index ac3d0e5..87ff0a4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2080,7 +2080,6 @@ function run() { let auth = !token || isGhes() ? undefined : `token ${token}`; const checkLatest = core.getBooleanInput('check-latest'); const installDir = yield installer.getGo(versionSpec, checkLatest, auth); - core.exportVariable('GOROOT', installDir); core.addPath(path_1.default.join(installDir, 'bin')); core.info('Added go to the path'); let added = yield addBinToPath(); diff --git a/src/main.ts b/src/main.ts index f785b85..7a9c1f5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -23,7 +23,6 @@ export async function run() { const checkLatest = core.getBooleanInput('check-latest'); const installDir = await installer.getGo(versionSpec, checkLatest, auth); - core.exportVariable('GOROOT', installDir); core.addPath(path.join(installDir, 'bin')); core.info('Added go to the path'); From 2a34c33bd7648b12fa2caabb0bfc8919e37aacc6 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Mon, 14 Mar 2022 12:21:30 -0400 Subject: [PATCH 04/13] Export `GOROOT` for versions < 1.9 --- __tests__/setup-go.test.ts | 61 +++++++++++++++++++++++++------------- dist/index.js | 7 +++++ src/main.ts | 8 +++++ 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/__tests__/setup-go.test.ts b/__tests__/setup-go.test.ts index 7bb3828..4c7efdc 100644 --- a/__tests__/setup-go.test.ts +++ b/__tests__/setup-go.test.ts @@ -20,6 +20,7 @@ describe('setup-go', () => { let inSpy: jest.SpyInstance; let getBooleanInputSpy: jest.SpyInstance; + let exportVarSpy: jest.SpyInstance; let findSpy: jest.SpyInstance; let cnSpy: jest.SpyInstance; let logSpy: jest.SpyInstance; @@ -27,7 +28,7 @@ describe('setup-go', () => { let platSpy: jest.SpyInstance; let archSpy: jest.SpyInstance; let dlSpy: jest.SpyInstance; - let exSpy: jest.SpyInstance; + let extractTarSpy: jest.SpyInstance; let cacheSpy: jest.SpyInstance; let dbgSpy: jest.SpyInstance; let whichSpy: jest.SpyInstance; @@ -49,7 +50,8 @@ describe('setup-go', () => { inSpy.mockImplementation(name => inputs[name]); getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); getBooleanInputSpy.mockImplementation(name => inputs[name]); - exSpy = jest.spyOn(core, 'exportVariable'); + exportVarSpy = jest.spyOn(core, 'exportVariable'); + extractTarSpy = jest.spyOn(core, 'exportVariable'); // node os = {}; @@ -62,7 +64,7 @@ describe('setup-go', () => { // @actions/tool-cache findSpy = jest.spyOn(tc, 'find'); dlSpy = jest.spyOn(tc, 'downloadTool'); - exSpy = jest.spyOn(tc, 'extractTar'); + extractTarSpy = jest.spyOn(tc, 'extractTar'); cacheSpy = jest.spyOn(tc, 'cacheDir'); getSpy = jest.spyOn(im, 'getVersionsDist'); getManifestSpy = jest.spyOn(tc, 'getManifestFromRepo'); @@ -231,15 +233,15 @@ describe('setup-go', () => { expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`); }); - it('does not export any varibles', async () => { + it('does not export any variables for Go versions >=1.9', async () => { inputs['go-version'] = '1.13.0'; inSpy.mockImplementation(name => inputs[name]); let toolPath = path.normalize('/cache/go/1.13.0/x64'); findSpy.mockImplementation(() => toolPath); - let vars = {} as any; - exSpy.mockImplementation(async (name, val) => { + let vars: { [key: string]: string; } = {}; + exportVarSpy.mockImplementation((name: string, val: string) => { vars[name] = val; }); @@ -247,6 +249,25 @@ describe('setup-go', () => { expect(vars).toStrictEqual({}); }); + it('exports GOROOT for Go versions <1.9', async () => { + inputs['go-version'] = '1.8'; + inSpy.mockImplementation(name => inputs[name]); + + let toolPath = path.normalize('/cache/go/1.8.0/x64'); + findSpy.mockImplementation(() => toolPath); + + let vars: { [key: string]: string; } = {}; + exportVarSpy.mockImplementation((name: string, val: string) => { + vars[name] = val; + }); + + await main.run(); + expect(vars).toStrictEqual({ + "GOROOT": toolPath + }); + }); + + it('finds a version of go already in the cache', async () => { inputs['go-version'] = '1.13.0'; @@ -288,14 +309,14 @@ describe('setup-go', () => { findSpy.mockImplementation(() => ''); dlSpy.mockImplementation(() => '/some/temp/path'); let toolPath = path.normalize('/cache/go/1.13.0/x64'); - exSpy.mockImplementation(() => '/some/other/temp/path'); + extractTarSpy.mockImplementation(() => '/some/other/temp/path'); cacheSpy.mockImplementation(() => toolPath); await main.run(); let expPath = path.join(toolPath, 'bin'); expect(dlSpy).toHaveBeenCalled(); - expect(exSpy).toHaveBeenCalled(); + expect(extractTarSpy).toHaveBeenCalled(); expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); }); @@ -330,7 +351,7 @@ describe('setup-go', () => { dlSpy.mockImplementation(async () => '/some/temp/path'); let toolPath = path.normalize('/cache/go/1.12.16/x64'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); + extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); cacheSpy.mockImplementation(async () => toolPath); await main.run(); @@ -338,7 +359,7 @@ describe('setup-go', () => { let expPath = path.join(toolPath, 'bin'); expect(dlSpy).toHaveBeenCalled(); - expect(exSpy).toHaveBeenCalled(); + expect(extractTarSpy).toHaveBeenCalled(); expect(logSpy).not.toHaveBeenCalledWith( 'Not found in manifest. Falling back to download directly from Go' ); @@ -367,7 +388,7 @@ describe('setup-go', () => { dlSpy.mockImplementation(async () => '/some/temp/path'); let toolPath = path.normalize('/cache/go/1.12.17/x64'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); + extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); cacheSpy.mockImplementation(async () => toolPath); await main.run(); @@ -375,7 +396,7 @@ describe('setup-go', () => { let expPath = path.join(toolPath, 'bin'); expect(dlSpy).toHaveBeenCalled(); - expect(exSpy).toHaveBeenCalled(); + expect(extractTarSpy).toHaveBeenCalled(); expect(logSpy).not.toHaveBeenCalledWith( 'Not found in manifest. Falling back to download directly from Go' ); @@ -404,7 +425,7 @@ describe('setup-go', () => { dlSpy.mockImplementation(async () => '/some/temp/path'); let toolPath = path.normalize('/cache/go/1.12.14/x64'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); + extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); cacheSpy.mockImplementation(async () => toolPath); await main.run(); @@ -415,7 +436,7 @@ describe('setup-go', () => { expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.12.14...'); expect(dlSpy).toHaveBeenCalled(); expect(logSpy).toHaveBeenCalledWith('matching 1.12.14...'); - expect(exSpy).toHaveBeenCalled(); + expect(extractTarSpy).toHaveBeenCalled(); expect(logSpy).toHaveBeenCalledWith( 'Not found in manifest. Falling back to download directly from Go' ); @@ -617,7 +638,7 @@ describe('setup-go', () => { const toolPath = path.normalize('/cache/go/1.16.1/x64'); findSpy.mockReturnValue(toolPath); dlSpy.mockImplementation(async () => '/some/temp/path'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); + extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); cacheSpy.mockImplementation(async () => toolPath); await main.run(); @@ -639,7 +660,7 @@ describe('setup-go', () => { findSpy.mockImplementation(() => ''); dlSpy.mockImplementation(async () => '/some/temp/path'); const toolPath = path.normalize('/cache/go/1.17.5/x64'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); + extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); cacheSpy.mockImplementation(async () => toolPath); const expectedUrl = 'https://github.com/actions/go-versions/releases/download/1.17.6-1668090892/go-1.17.6-darwin-x64.tar.gz'; @@ -680,7 +701,7 @@ describe('setup-go', () => { dlSpy.mockImplementation(async () => '/some/temp/path'); let toolPath = path.normalize('/cache/go/1.13.7/x64'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); + extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); cacheSpy.mockImplementation(async () => toolPath); await main.run(); @@ -688,7 +709,7 @@ describe('setup-go', () => { let expPath = path.join(toolPath, 'bin'); expect(dlSpy).toHaveBeenCalled(); - expect(exSpy).toHaveBeenCalled(); + expect(extractTarSpy).toHaveBeenCalled(); expect(logSpy).toHaveBeenCalledWith( 'Attempting to resolve the latest version from the manifest...' ); @@ -722,7 +743,7 @@ describe('setup-go', () => { dlSpy.mockImplementation(async () => '/some/temp/path'); let toolPath = path.normalize('/cache/go/1.13.7/x64'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); + extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); cacheSpy.mockImplementation(async () => toolPath); await main.run(); @@ -733,7 +754,7 @@ describe('setup-go', () => { `Failed to resolve version ${versionSpec} from manifest` ); expect(dlSpy).toHaveBeenCalled(); - expect(exSpy).toHaveBeenCalled(); + expect(extractTarSpy).toHaveBeenCalled(); expect(logSpy).toHaveBeenCalledWith( 'Attempting to resolve the latest version from the manifest...' ); diff --git a/dist/index.js b/dist/index.js index 87ff0a4..99a304b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2062,6 +2062,7 @@ exports.addBinToPath = exports.run = void 0; const core = __importStar(__webpack_require__(470)); const io = __importStar(__webpack_require__(1)); const installer = __importStar(__webpack_require__(749)); +const semver = __importStar(__webpack_require__(280)); const path_1 = __importDefault(__webpack_require__(622)); const child_process_1 = __importDefault(__webpack_require__(129)); const fs_1 = __importDefault(__webpack_require__(747)); @@ -2082,6 +2083,12 @@ function run() { const installDir = yield installer.getGo(versionSpec, checkLatest, auth); core.addPath(path_1.default.join(installDir, 'bin')); 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(); core.debug(`add bin ${added}`); core.info(`Successfully setup go version ${versionSpec}`); diff --git a/src/main.ts b/src/main.ts index 7a9c1f5..afb59fc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,7 @@ import * as core from '@actions/core'; import * as io from '@actions/io'; import * as installer from './installer'; +import * as semver from 'semver'; import path from 'path'; import cp from 'child_process'; import fs from 'fs'; @@ -26,6 +27,13 @@ export async function run() { core.addPath(path.join(installDir, 'bin')); 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 = await addBinToPath(); core.debug(`add bin ${added}`); core.info(`Successfully setup go version ${versionSpec}`); From 802876f7c7e9ca0bae4bf73e507f4400ad8e567f Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Mon, 14 Mar 2022 12:23:03 -0400 Subject: [PATCH 05/13] Fix formatting --- __tests__/setup-go.test.ts | 7 +++---- src/main.ts | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/__tests__/setup-go.test.ts b/__tests__/setup-go.test.ts index 4c7efdc..3383e99 100644 --- a/__tests__/setup-go.test.ts +++ b/__tests__/setup-go.test.ts @@ -240,7 +240,7 @@ describe('setup-go', () => { let toolPath = path.normalize('/cache/go/1.13.0/x64'); findSpy.mockImplementation(() => toolPath); - let vars: { [key: string]: string; } = {}; + let vars: {[key: string]: string} = {}; exportVarSpy.mockImplementation((name: string, val: string) => { vars[name] = val; }); @@ -256,18 +256,17 @@ describe('setup-go', () => { let toolPath = path.normalize('/cache/go/1.8.0/x64'); findSpy.mockImplementation(() => toolPath); - let vars: { [key: string]: string; } = {}; + let vars: {[key: string]: string} = {}; exportVarSpy.mockImplementation((name: string, val: string) => { vars[name] = val; }); await main.run(); expect(vars).toStrictEqual({ - "GOROOT": toolPath + GOROOT: toolPath }); }); - it('finds a version of go already in the cache', async () => { inputs['go-version'] = '1.13.0'; diff --git a/src/main.ts b/src/main.ts index afb59fc..4295858 100644 --- a/src/main.ts +++ b/src/main.ts @@ -30,7 +30,7 @@ export async function run() { 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.info('Setting GOROOT for Go version < 1.9'); core.exportVariable('GOROOT', installDir); } From 229eefa42bc953e2e5c73d5532f977c10cc2b271 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Mon, 14 Mar 2022 12:24:32 -0400 Subject: [PATCH 06/13] Update `dist` --- dist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 99a304b..7a7a59c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2086,7 +2086,7 @@ function run() { 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.info('Setting GOROOT for Go version < 1.9'); core.exportVariable('GOROOT', installDir); } let added = yield addBinToPath(); From 0c03929337ba6c12b883b8b7361696700b6d82c8 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Mon, 14 Mar 2022 12:32:36 -0400 Subject: [PATCH 07/13] Remove duplicated `spyOn` --- __tests__/setup-go.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/__tests__/setup-go.test.ts b/__tests__/setup-go.test.ts index 3383e99..bb85dee 100644 --- a/__tests__/setup-go.test.ts +++ b/__tests__/setup-go.test.ts @@ -51,7 +51,6 @@ describe('setup-go', () => { getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); getBooleanInputSpy.mockImplementation(name => inputs[name]); exportVarSpy = jest.spyOn(core, 'exportVariable'); - extractTarSpy = jest.spyOn(core, 'exportVariable'); // node os = {}; From fcc0174ef23da28e9cb3dfa407260c8ed71ff241 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Mar 2022 11:54:47 +0000 Subject: [PATCH 08/13] Bump minimist from 1.2.5 to 1.2.6 Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 293 +--------------------------------------------- 1 file changed, 6 insertions(+), 287 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2aeb292..842ea23 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3335,9 +3335,9 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "node_modules/mkdirp": { @@ -4194,145 +4194,6 @@ } } }, - "node_modules/ts-jest/node_modules/@jest/types": { - "version": "27.1.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.1.0.tgz", - "integrity": "sha512-pRP5cLIzN7I7Vp6mHKRSaZD7YpBTK7hawx5si8trMKqk4+WOdK8NEKOTO2G8PKWD1HbKMVckVB6/XHh/olhf2g==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^16.0.0", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/ts-jest/node_modules/@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-report": "*" - } - }, - "node_modules/ts-jest/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", - "dev": true, - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/ts-jest/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/ts-jest/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/ts-jest/node_modules/ci-info": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.2.0.tgz", - "integrity": "sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A==", - "dev": true - }, - "node_modules/ts-jest/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/ts-jest/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/ts-jest/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ts-jest/node_modules/is-ci": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.0.tgz", - "integrity": "sha512-kDXyttuLeslKAHYL/K28F2YkM3x5jvFPEw3yXbRptXydjD9rpLEz+C5K5iutY9ZiUu6AP41JdvRQwF4Iqs4ZCQ==", - "dev": true, - "dependencies": { - "ci-info": "^3.1.1" - }, - "bin": { - "is-ci": "bin.js" - } - }, - "node_modules/ts-jest/node_modules/jest-util": { - "version": "27.1.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.1.0.tgz", - "integrity": "sha512-edSLD2OneYDKC6gZM1yc+wY/877s/fuJNoM1k3sOEpzFyeptSmke3SLnk1dDHk9CgTA+58mnfx3ew3J11Kes/w==", - "dev": true, - "dependencies": { - "@jest/types": "^27.1.0", - "@types/node": "*", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "is-ci": "^3.0.0", - "picomatch": "^2.2.3" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/ts-jest/node_modules/picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/ts-jest/node_modules/semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -4348,27 +4209,6 @@ "node": ">=10" } }, - "node_modules/ts-jest/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ts-jest/node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/tunnel": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", @@ -7241,9 +7081,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "mkdirp": { @@ -7878,112 +7718,6 @@ "yargs-parser": "20.x" }, "dependencies": { - "@jest/types": { - "version": "27.1.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.1.0.tgz", - "integrity": "sha512-pRP5cLIzN7I7Vp6mHKRSaZD7YpBTK7hawx5si8trMKqk4+WOdK8NEKOTO2G8PKWD1HbKMVckVB6/XHh/olhf2g==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^16.0.0", - "chalk": "^4.0.0" - } - }, - "@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", - "dev": true, - "requires": { - "@types/istanbul-lib-report": "*" - } - }, - "@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", - "dev": true, - "requires": { - "@types/yargs-parser": "*" - } - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "ci-info": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.2.0.tgz", - "integrity": "sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A==", - "dev": true - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "is-ci": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.0.tgz", - "integrity": "sha512-kDXyttuLeslKAHYL/K28F2YkM3x5jvFPEw3yXbRptXydjD9rpLEz+C5K5iutY9ZiUu6AP41JdvRQwF4Iqs4ZCQ==", - "dev": true, - "requires": { - "ci-info": "^3.1.1" - } - }, - "jest-util": { - "version": "27.1.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.1.0.tgz", - "integrity": "sha512-edSLD2OneYDKC6gZM1yc+wY/877s/fuJNoM1k3sOEpzFyeptSmke3SLnk1dDHk9CgTA+58mnfx3ew3J11Kes/w==", - "dev": true, - "requires": { - "@jest/types": "^27.1.0", - "@types/node": "*", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "is-ci": "^3.0.0", - "picomatch": "^2.2.3" - } - }, - "picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", - "dev": true - }, "semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -7992,21 +7726,6 @@ "requires": { "lru-cache": "^6.0.0" } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true } } }, From 3e6475c0895c22f1c37baa9e1459209a69c106d2 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Fri, 25 Mar 2022 09:53:28 +0100 Subject: [PATCH 09/13] Update README to v3 --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0ecccd9..b6b35ed 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ This action sets up a go environment for use in actions by: - optionally downloading and caching a version of Go by version and adding to PATH - registering problem matchers for error output -# V2 +# V3 -The V2 offers: +The V3 offers: - Adds GOBIN to the PATH - Proxy Support - `stable` input @@ -26,7 +26,7 @@ Matching by [semver spec](https://github.com/npm/node-semver): ```yaml steps: - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: go-version: '^1.13.1' # The Go version to download (if necessary) and use. - run: go version @@ -36,7 +36,7 @@ Matching an unstable pre-release: ```yaml steps: - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: stable: 'false' go-version: '1.14.0-rc1' # The Go version to download (if necessary) and use. @@ -51,7 +51,7 @@ See [action.yml](action.yml) ```yaml steps: - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: go-version: '1.16.1' # The Go version to download (if necessary) and use. - run: go run hello.go @@ -69,7 +69,7 @@ If `check-latest` is set to `true`, the action first checks if the cached versio ```yaml steps: - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: go-version: '1.14' check-latest: true @@ -88,7 +88,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Setup go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ matrix.go }} - run: go run hello.go From acdbc5377c8956fada49a1aa112d8947d858b586 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 28 Mar 2022 10:24:34 +0200 Subject: [PATCH 10/13] Remove stable input description from README --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index b6b35ed..3fe7e26 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ This action sets up a go environment for use in actions by: The V3 offers: - Adds GOBIN to the PATH - Proxy Support -- `stable` input - Check latest version - Bug Fixes (including issues around version matching and semver) From 0b4fbc55f69074262aa9acb2b3596a7c52e35e1c Mon Sep 17 00:00:00 2001 From: Fraser Waters Date: Mon, 28 Mar 2022 10:54:44 +0100 Subject: [PATCH 11/13] await io.mkdirP --- src/main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index 4295858..34784c4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -73,13 +73,13 @@ export async function addBinToPath(): Promise { if (!fs.existsSync(gp)) { // some of the hosted images have go install but not profile dir core.debug(`creating ${gp}`); - io.mkdirP(gp); + await io.mkdirP(gp); } let bp = path.join(gp, 'bin'); if (!fs.existsSync(bp)) { core.debug(`creating ${bp}`); - io.mkdirP(bp); + await io.mkdirP(bp); } core.addPath(bp); From 13df686579e9d731c722f087cea96cac54046285 Mon Sep 17 00:00:00 2001 From: Fraser Waters Date: Mon, 28 Mar 2022 14:23:54 +0100 Subject: [PATCH 12/13] Update dist --- dist/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 7a7a59c..48ceb03 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2127,12 +2127,12 @@ function addBinToPath() { if (!fs_1.default.existsSync(gp)) { // some of the hosted images have go install but not profile dir core.debug(`creating ${gp}`); - io.mkdirP(gp); + yield io.mkdirP(gp); } let bp = path_1.default.join(gp, 'bin'); if (!fs_1.default.existsSync(bp)) { core.debug(`creating ${bp}`); - io.mkdirP(bp); + yield io.mkdirP(bp); } core.addPath(bp); added = true; From 341b20ac366f562d862de34cf8ecb3d9b8dc9dc8 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Tue, 29 Mar 2022 22:16:03 +0300 Subject: [PATCH 13/13] Update usage examples on readme (#212) * Fix action usage examples on readme * Revert changes on package-lock * Fix some checkout action version --- README.md | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3fe7e26..ee5557b 100644 --- a/README.md +++ b/README.md @@ -24,21 +24,38 @@ The action will first check the local cache for a version match. If a version is Matching by [semver spec](https://github.com/npm/node-semver): ```yaml steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: go-version: '^1.13.1' # The Go version to download (if necessary) and use. - run: go version ``` +```yaml +steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: '>=1.17.0' + - run: go version +``` + Matching an unstable pre-release: ```yaml steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - stable: 'false' - go-version: '1.14.0-rc1' # The Go version to download (if necessary) and use. + go-version: '1.18.0-rc.1' # The Go version to download (if necessary) and use. + - run: go version +``` + +```yaml +steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: '1.16.0-beta.1' # The Go version to download (if necessary) and use. - run: go version ``` @@ -49,7 +66,7 @@ See [action.yml](action.yml) ## Basic: ```yaml steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: go-version: '1.16.1' # The Go version to download (if necessary) and use. @@ -67,7 +84,7 @@ If `check-latest` is set to `true`, the action first checks if the cached versio ```yaml steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: go-version: '1.14' @@ -85,7 +102,7 @@ jobs: go: [ '1.14', '1.13' ] name: Go ${{ matrix.go }} sample steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup go uses: actions/setup-go@v3 with: @@ -96,8 +113,8 @@ jobs: ### Supported version syntax The `go-version` input supports the following syntax: -Specific versions: `1.15`, `1.16.1`, `1.17.0-rc2`, `1.16.0-beta1` -SemVer's version range syntax: `^1.13.1` +Specific versions: `1.15`, `1.16.1`, `1.17.0-rc.2`, `1.16.0-beta.1` +SemVer's version range syntax: `^1.13.1`, `>=1.18.0-rc.1` For more information about semantic versioning please refer [semver](https://github.com/npm/node-semver) documentation # License