mirror of https://github.com/actions/setup-go.git
				
				
				
			Merge f89ad3b87c into faf52423ec
				
					
				
			This commit is contained in:
		
						commit
						f876d39c24
					
				|  | @ -8,6 +8,7 @@ import path from 'path'; | ||||||
| import * as main from '../src/main'; | import * as main from '../src/main'; | ||||||
| import * as im from '../src/installer'; | import * as im from '../src/installer'; | ||||||
| import * as httpm from '@actions/http-client'; | import * as httpm from '@actions/http-client'; | ||||||
|  | import {getArch} from '../src/system'; | ||||||
| 
 | 
 | ||||||
| import goJsonData from './data/golang-dl.json'; | import goJsonData from './data/golang-dl.json'; | ||||||
| import matchers from '../matchers.json'; | import matchers from '../matchers.json'; | ||||||
|  | @ -32,6 +33,7 @@ describe('setup-go', () => { | ||||||
|   let getSpy: jest.SpyInstance; |   let getSpy: jest.SpyInstance; | ||||||
|   let platSpy: jest.SpyInstance; |   let platSpy: jest.SpyInstance; | ||||||
|   let archSpy: jest.SpyInstance; |   let archSpy: jest.SpyInstance; | ||||||
|  |   let endianSpy: jest.SpyInstance; | ||||||
|   let joinSpy: jest.SpyInstance; |   let joinSpy: jest.SpyInstance; | ||||||
|   let dlSpy: jest.SpyInstance; |   let dlSpy: jest.SpyInstance; | ||||||
|   let extractTarSpy: jest.SpyInstance; |   let extractTarSpy: jest.SpyInstance; | ||||||
|  | @ -71,6 +73,8 @@ describe('setup-go', () => { | ||||||
|     archSpy = jest.spyOn(osm, 'arch'); |     archSpy = jest.spyOn(osm, 'arch'); | ||||||
|     archSpy.mockImplementation(() => os['arch']); |     archSpy.mockImplementation(() => os['arch']); | ||||||
|     execSpy = jest.spyOn(cp, 'execSync'); |     execSpy = jest.spyOn(cp, 'execSync'); | ||||||
|  |     endianSpy = jest.spyOn(osm, 'endianness'); | ||||||
|  |     endianSpy.mockImplementation(() => os['endianness']); | ||||||
| 
 | 
 | ||||||
|     // switch path join behaviour based on set os.platform
 |     // switch path join behaviour based on set os.platform
 | ||||||
|     joinSpy = jest.spyOn(path, 'join'); |     joinSpy = jest.spyOn(path, 'join'); | ||||||
|  | @ -1004,6 +1008,18 @@ use . | ||||||
|         ); |         ); | ||||||
|       } |       } | ||||||
|     ); |     ); | ||||||
|  | 
 | ||||||
|  |     it('should return ppc64 when architecture is ppc64 and system is Big Endian', () => { | ||||||
|  |       endianSpy.mockReturnValue('BE'); | ||||||
|  |       const result = getArch('ppc64'); | ||||||
|  |       expect(result).toBe('ppc64'); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     it('should return ppc64le when architecture is ppc64 and system is Little Endian', () => { | ||||||
|  |       endianSpy.mockReturnValue('LE'); | ||||||
|  |       const result = getArch('ppc64'); | ||||||
|  |       expect(result).toBe('ppc64le'); | ||||||
|  |     }); | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   describe('go-version-file-toolchain', () => { |   describe('go-version-file-toolchain', () => { | ||||||
|  |  | ||||||
|  | @ -94967,15 +94967,23 @@ function getPlatform() { | ||||||
| } | } | ||||||
| function getArch(arch) { | function getArch(arch) { | ||||||
|     // 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
 |     // 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
 | ||||||
|     // wants amd64, 386, arm64, armv61, ppc641e, s390x
 |     // wants amd64, 386, arm64, armv6l, ppc64le, s390x
 | ||||||
|     // currently not supported by runner but future proofed mapping
 |     // currently not supported by runner but future proofed mapping
 | ||||||
|     switch (arch) { |     switch (arch) { | ||||||
|         case 'x64': |         case 'x64': | ||||||
|             arch = 'amd64'; |             arch = 'amd64'; | ||||||
|             break; |             break; | ||||||
|         // case 'ppc':
 |         // In case of ppc64, further distinction is needed to determine the endianness
 | ||||||
|         //   arch = 'ppc64';
 |         // of the host as it can either be ppc64(Big Endian) or ppc64le (Little Endian) to download
 | ||||||
|         //   break;
 |         // the correct bundle.
 | ||||||
|  |         case 'ppc64': | ||||||
|  |             if (os_1.default.endianness() === 'LE') { | ||||||
|  |                 arch = 'ppc64le'; | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  |                 arch = 'ppc64'; | ||||||
|  |             } | ||||||
|  |             break; | ||||||
|         case 'x32': |         case 'x32': | ||||||
|             arch = '386'; |             arch = '386'; | ||||||
|             break; |             break; | ||||||
|  |  | ||||||
|  | @ -19,15 +19,22 @@ export function getPlatform(): string { | ||||||
| export function getArch(arch: Architecture): string { | export function getArch(arch: Architecture): string { | ||||||
|   // 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
 |   // 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
 | ||||||
| 
 | 
 | ||||||
|   // wants amd64, 386, arm64, armv61, ppc641e, s390x
 |   // wants amd64, 386, arm64, armv6l, ppc64le, s390x
 | ||||||
|   // currently not supported by runner but future proofed mapping
 |   // currently not supported by runner but future proofed mapping
 | ||||||
|   switch (arch) { |   switch (arch) { | ||||||
|     case 'x64': |     case 'x64': | ||||||
|       arch = 'amd64'; |       arch = 'amd64'; | ||||||
|       break; |       break; | ||||||
|     // case 'ppc':
 |     // In case of ppc64, further distinction is needed to determine the endianness
 | ||||||
|     //   arch = 'ppc64';
 |     // of the host as it can either be ppc64(Big Endian) or ppc64le (Little Endian) to download
 | ||||||
|     //   break;
 |     // the correct bundle.
 | ||||||
|  |     case 'ppc64': | ||||||
|  |       if (os.endianness() === 'LE') { | ||||||
|  |         arch = 'ppc64le'; | ||||||
|  |       } else { | ||||||
|  |         arch = 'ppc64'; | ||||||
|  |       } | ||||||
|  |       break; | ||||||
|     case 'x32': |     case 'x32': | ||||||
|       arch = '386'; |       arch = '386'; | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Kishen Viswanathan
						Kishen Viswanathan