diff --git a/__tests__/setup-go.test.ts b/__tests__/setup-go.test.ts index 05f4eb5..ffe17e2 100644 --- a/__tests__/setup-go.test.ts +++ b/__tests__/setup-go.test.ts @@ -132,7 +132,7 @@ describe('setup-go', () => { it('can find 1.9.7 from manifest on osx', async () => { os.platform = 'darwin'; - sysGetArchSpy.mockImplementationOnce(() => 'x64'); + os.arch = 'x64'; let match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken'); expect(match).toBeDefined(); @@ -145,7 +145,7 @@ describe('setup-go', () => { it('can find 1.9 from manifest on linux', async () => { os.platform = 'linux'; - sysGetArchSpy.mockImplementationOnce(() => 'x64'); + os.arch = 'x64'; let match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken'); expect(match).toBeDefined(); @@ -158,7 +158,7 @@ describe('setup-go', () => { it('can find 1.9 from manifest on windows', async () => { os.platform = 'win32'; - sysGetArchSpy.mockImplementationOnce(() => 'x64'); + os.arch = 'x64'; let match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken'); expect(match).toBeDefined(); @@ -325,13 +325,13 @@ describe('setup-go', () => { it('downloads a version not in the cache', async () => { os.platform = 'linux'; - os.arch = 'x64'; + sysGetArchSpy.mockImplementationOnce(() => 'amd64'); inputs['go-version'] = '1.13.1'; findSpy.mockImplementation(() => ''); dlSpy.mockImplementation(() => '/some/temp/path'); - let toolPath = path.normalize('/cache/go/1.13.0/x64'); + let toolPath = path.normalize('/cache/go/1.13.0/amd64'); extractTarSpy.mockImplementation(() => '/some/other/temp/path'); cacheSpy.mockImplementation(() => toolPath); await main.run(); @@ -345,7 +345,7 @@ describe('setup-go', () => { it('downloads a version not in the cache (windows)', async () => { os.platform = 'win32'; - os.arch = 'x64'; + sysGetArchSpy.mockImplementationOnce(() => 'amd64'); inputs['go-version'] = '1.13.1'; process.env['RUNNER_TEMP'] = 'C:\\temp\\'; @@ -354,7 +354,7 @@ describe('setup-go', () => { dlSpy.mockImplementation(() => 'C:\\temp\\some\\path'); extractZipSpy.mockImplementation(() => 'C:\\temp\\some\\other\\path'); - let toolPath = path.normalize('C:\\cache\\go\\1.13.0\\x64'); + let toolPath = path.normalize('C:\\cache\\go\\1.13.0\\amd64'); cacheSpy.mockImplementation(() => toolPath); await main.run(); @@ -370,7 +370,7 @@ describe('setup-go', () => { it('does not find a version that does not exist', async () => { os.platform = 'linux'; - sysGetArchSpy.mockImplementationOnce(() => 'x64'); + os.arch = 'x64'; inputs['go-version'] = '9.99.9'; @@ -384,7 +384,7 @@ describe('setup-go', () => { it('downloads a version from a manifest match', async () => { os.platform = 'linux'; - sysGetArchSpy.mockImplementationOnce(() => 'x64'); + os.arch = 'x64'; let versionSpec = '1.12.16'; @@ -421,7 +421,7 @@ describe('setup-go', () => { it('downloads a major and minor from a manifest match', async () => { os.platform = 'linux'; - sysGetArchSpy.mockImplementationOnce(() => 'x64'); + os.arch = 'x64'; let versionSpec = '1.12'; @@ -458,7 +458,7 @@ describe('setup-go', () => { it('falls back to a version from go dist', async () => { os.platform = 'linux'; - os.arch = 'x64'; + sysGetArchSpy.mockImplementationOnce(() => 'amd64'); let versionSpec = '1.12.14'; @@ -466,13 +466,13 @@ describe('setup-go', () => { inputs['token'] = 'faketoken'; let expectedUrl = - 'https://github.com/actions/go-versions/releases/download/1.12.14-20200616.18/go-1.12.14-linux-x64.tar.gz'; + 'https://github.com/actions/go-versions/releases/download/1.12.14-20200616.18/go-1.12.14-linux-amd64.tar.gz'; // ... but not in the local cache findSpy.mockImplementation(() => ''); dlSpy.mockImplementation(async () => '/some/temp/path'); - let toolPath = path.normalize('/cache/go/1.12.14/x64'); + let toolPath = path.normalize('/cache/go/1.12.14/amd64'); extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); cacheSpy.mockImplementation(async () => toolPath); @@ -496,7 +496,7 @@ describe('setup-go', () => { it('reports a failed download', async () => { let errMsg = 'unhandled download message'; os.platform = 'linux'; - os.arch = 'x64'; + sysGetArchSpy.mockImplementationOnce(() => 'amd64'); inputs['go-version'] = '1.13.1'; @@ -697,7 +697,7 @@ describe('setup-go', () => { it('check latest version and install it from manifest', async () => { os.platform = 'linux'; - sysGetArchSpy.mockImplementationOnce(() => 'x64'); + os.arch = 'x64'; const versionSpec = '1.17'; const patchVersion = '1.17.6'; @@ -735,7 +735,7 @@ describe('setup-go', () => { it('fallback to dist if version is not found in manifest', async () => { os.platform = 'linux'; - os.arch = 'x64'; + sysGetArchSpy.mockImplementationOnce(() => 'amd64'); let versionSpec = '1.13'; @@ -748,7 +748,7 @@ describe('setup-go', () => { findSpy.mockImplementation(() => ''); dlSpy.mockImplementation(async () => '/some/temp/path'); - let toolPath = path.normalize('/cache/go/1.13.7/x64'); + let toolPath = path.normalize('/cache/go/1.13.7/amd64'); extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); cacheSpy.mockImplementation(async () => toolPath); @@ -772,7 +772,7 @@ describe('setup-go', () => { it('fallback to dist if manifest is not available', async () => { os.platform = 'linux'; - os.arch = 'x64'; + sysGetArchSpy.mockImplementationOnce(() => 'amd64'); let versionSpec = '1.13'; @@ -790,7 +790,7 @@ describe('setup-go', () => { }); dlSpy.mockImplementation(async () => '/some/temp/path'); - let toolPath = path.normalize('/cache/go/1.13.7/x64'); + let toolPath = path.normalize('/cache/go/1.13.7/amd64'); extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); cacheSpy.mockImplementation(async () => toolPath); diff --git a/dist/setup/index.js b/dist/setup/index.js index bac12fd..1d12b40 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -62858,7 +62858,7 @@ const httpm = __importStar(__nccwpck_require__(6255)); const sys = __importStar(__nccwpck_require__(4300)); const fs_1 = __importDefault(__nccwpck_require__(7147)); const os_1 = __importDefault(__nccwpck_require__(2037)); -function getGo(versionSpec, checkLatest, auth, arch = sys.getArch()) { +function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) { return __awaiter(this, void 0, void 0, function* () { let osPlat = os_1.default.platform(); if (checkLatest) { @@ -62972,7 +62972,7 @@ function extractGoArchive(archivePath) { }); } exports.extractGoArchive = extractGoArchive; -function getInfoFromManifest(versionSpec, stable, auth, arch = sys.getArch()) { +function getInfoFromManifest(versionSpec, stable, auth, arch = os_1.default.arch()) { return __awaiter(this, void 0, void 0, function* () { let info = null; const releases = yield tc.getManifestFromRepo('actions', 'go-versions', auth, 'main'); diff --git a/src/installer.ts b/src/installer.ts index 4e69bd9..58e33db 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -33,7 +33,7 @@ export async function getGo( versionSpec: string, checkLatest: boolean, auth: string | undefined, - arch = sys.getArch() + arch = os.arch() ) { let osPlat: string = os.platform(); @@ -178,7 +178,7 @@ export async function getInfoFromManifest( versionSpec: string, stable: boolean, auth: string | undefined, - arch = sys.getArch() + arch = os.arch() ): Promise { let info: IGoVersionInfo | null = null; const releases = await tc.getManifestFromRepo(