mirror of
				https://github.com/actions/setup-go.git
				synced 2025-10-29 22:30:31 +00:00 
			
		
		
		
	Compare commits
	
		
			7 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 41dfa10bad | ||
|   | 941977282c | ||
|   | d60b41a563 | ||
|   | e09f57f6a9 | ||
|   | df1a11710e | ||
|   | 49582f6476 | ||
|   | b26d40294f | 
							
								
								
									
										20
									
								
								.github/workflows/publish-immutable-actions.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								.github/workflows/publish-immutable-actions.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| name: 'Publish Immutable Action Version' | ||||
|  | ||||
| on: | ||||
|   release: | ||||
|     types: [published] | ||||
|  | ||||
| jobs: | ||||
|   publish: | ||||
|     runs-on: ubuntu-latest | ||||
|     permissions: | ||||
|       contents: read | ||||
|       id-token: write | ||||
|       packages: write | ||||
|  | ||||
|     steps: | ||||
|       - name: Checking out | ||||
|         uses: actions/checkout@v4 | ||||
|       - name: Publish | ||||
|         id: publish | ||||
|         uses: actions/publish-immutable-action@0.0.3 | ||||
| @@ -22,7 +22,7 @@ jobs: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Update the ${{ env.TAG_NAME }} tag | ||||
|         uses: actions/publish-action@v0.2.2 | ||||
|         uses: actions/publish-action@v0.3.0 | ||||
|         with: | ||||
|           source-tag: ${{ env.TAG_NAME }} | ||||
|           slack-webhook: ${{ secrets.SLACK_WEBHOOK }} | ||||
|   | ||||
							
								
								
									
										51
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										51
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							| @@ -18,7 +18,7 @@ jobs: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go Stable | ||||
| @@ -33,7 +33,7 @@ jobs: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go oldStable | ||||
| @@ -48,12 +48,14 @@ jobs: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|         version: [stable, oldstable] | ||||
|         architecture: [x64, x32] | ||||
|         exclude: | ||||
|           - os: macos-latest | ||||
|             architecture: x32 | ||||
|           - os: macos-13 | ||||
|             architecture: x32 | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go ${{ matrix.version }} ${{ matrix.architecture }} | ||||
| @@ -70,8 +72,14 @@ jobs: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [macos-latest, windows-latest, ubuntu-latest] | ||||
|         go: [1.20.14, 1.21.10, 1.22.3] | ||||
|         os: [macos-latest, windows-latest, ubuntu-latest, macos-13] | ||||
|         go: [1.21.13, 1.22.8, 1.23.2] | ||||
|         include: | ||||
|           - os: windows-latest | ||||
|             go: 1.20.14 | ||||
|         exclude: | ||||
|           - os: windows-latest | ||||
|             go: 1.23.2 | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
| @@ -90,8 +98,8 @@ jobs: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         go-version: [1.20.14, 1.21] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|         go-version: ['1.20', '1.21', '1.22', '1.23'] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go and check latest | ||||
| @@ -107,7 +115,7 @@ jobs: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go and check latest | ||||
| @@ -123,7 +131,7 @@ jobs: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go and check latest | ||||
| @@ -135,13 +143,12 @@ jobs: | ||||
|         shell: bash | ||||
|  | ||||
|   setup-versions-from-manifest: | ||||
|     name: Setup ${{ matrix.go }} ${{ matrix.os }} | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [macos-latest, windows-latest, ubuntu-latest] | ||||
|         go: [1.20.14, 1.21.10, 1.22.3] | ||||
|         os: [macos-latest, windows-latest, ubuntu-latest, macos-13] | ||||
|         go: [1.20.14, 1.21.10, 1.22.8, 1.23.2] | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
| @@ -156,13 +163,12 @@ jobs: | ||||
|         shell: bash | ||||
|  | ||||
|   setup-versions-from-dist: | ||||
|     name: Setup ${{ matrix.go }} ${{ matrix.os }} | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [macos-latest, windows-latest, ubuntu-latest] | ||||
|         go: [1.20.14, 1.21] | ||||
|         os: [windows-latest, ubuntu-latest, macos-13] | ||||
|         go: [1.11.12] | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
| @@ -181,14 +187,23 @@ jobs: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         go-version: [1.20.14, 1.21] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|         go-version: [1.20.14, 1.21, 1.22, 1.23] | ||||
|         include: | ||||
|           - os: macos-latest | ||||
|             architecture: arm64 | ||||
|           - os: ubuntu-latest | ||||
|             architecture: x64 | ||||
|           - os: windows-latest | ||||
|             architecture: x64 | ||||
|           - os: macos-13 | ||||
|             architecture: x64 | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go and check latest | ||||
|         uses: ./ | ||||
|         with: | ||||
|           go-version: ${{ matrix.go-version }} | ||||
|           architecture: x64 | ||||
|           architecture: ${{ matrix.architecture }} | ||||
|       - name: Verify Go | ||||
|         run: go version | ||||
|   | ||||
| @@ -209,3 +209,41 @@ describe('isCacheFeatureAvailable', () => { | ||||
|     expect(warningSpy).toHaveBeenCalledWith(warningMessage); | ||||
|   }); | ||||
| }); | ||||
|  | ||||
| describe('isGhes', () => { | ||||
|   const pristineEnv = process.env; | ||||
|  | ||||
|   beforeEach(() => { | ||||
|     jest.resetModules(); | ||||
|     process.env = {...pristineEnv}; | ||||
|   }); | ||||
|  | ||||
|   afterAll(() => { | ||||
|     process.env = pristineEnv; | ||||
|   }); | ||||
|  | ||||
|   it('returns false when the GITHUB_SERVER_URL environment variable is not defined', async () => { | ||||
|     delete process.env['GITHUB_SERVER_URL']; | ||||
|     expect(cacheUtils.isGhes()).toBeFalsy(); | ||||
|   }); | ||||
|  | ||||
|   it('returns false when the GITHUB_SERVER_URL environment variable is set to github.com', async () => { | ||||
|     process.env['GITHUB_SERVER_URL'] = 'https://github.com'; | ||||
|     expect(cacheUtils.isGhes()).toBeFalsy(); | ||||
|   }); | ||||
|  | ||||
|   it('returns false when the GITHUB_SERVER_URL environment variable is set to a GitHub Enterprise Cloud-style URL', async () => { | ||||
|     process.env['GITHUB_SERVER_URL'] = 'https://contoso.ghe.com'; | ||||
|     expect(cacheUtils.isGhes()).toBeFalsy(); | ||||
|   }); | ||||
|  | ||||
|   it('returns false when the GITHUB_SERVER_URL environment variable has a .localhost suffix', async () => { | ||||
|     process.env['GITHUB_SERVER_URL'] = 'https://mock-github.localhost'; | ||||
|     expect(cacheUtils.isGhes()).toBeFalsy(); | ||||
|   }); | ||||
|  | ||||
|   it('returns true when the GITHUB_SERVER_URL environment variable is set to some other URL', async () => { | ||||
|     process.env['GITHUB_SERVER_URL'] = 'https://src.onpremise.fabrikam.com'; | ||||
|     expect(cacheUtils.isGhes()).toBeTruthy(); | ||||
|   }); | ||||
| }); | ||||
|   | ||||
							
								
								
									
										6
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -81175,7 +81175,11 @@ const getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, | ||||
| exports.getCacheDirectoryPath = getCacheDirectoryPath; | ||||
| function isGhes() { | ||||
|     const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); | ||||
|     return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; | ||||
|     const hostname = ghUrl.hostname.trimEnd().toUpperCase(); | ||||
|     const isGitHubHost = hostname === 'GITHUB.COM'; | ||||
|     const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM'); | ||||
|     const isLocalHost = hostname.endsWith('.LOCALHOST'); | ||||
|     return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost; | ||||
| } | ||||
| exports.isGhes = isGhes; | ||||
| function isCacheFeatureAvailable() { | ||||
|   | ||||
							
								
								
									
										9
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -88045,6 +88045,7 @@ const cache_utils_1 = __nccwpck_require__(1678); | ||||
| const restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () { | ||||
|     const packageManagerInfo = yield (0, cache_utils_1.getPackageManagerInfo)(packageManager); | ||||
|     const platform = process.env.RUNNER_OS; | ||||
|     const arch = process.arch; | ||||
|     const cachePaths = yield (0, cache_utils_1.getCacheDirectoryPath)(packageManagerInfo); | ||||
|     const dependencyFilePath = cacheDependencyPath | ||||
|         ? cacheDependencyPath | ||||
| @@ -88054,7 +88055,7 @@ const restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __awa | ||||
|         throw new Error('Some specified paths were not resolved, unable to cache dependencies.'); | ||||
|     } | ||||
|     const linuxVersion = process.env.RUNNER_OS === 'Linux' ? `${process.env.ImageOS}-` : ''; | ||||
|     const primaryKey = `setup-go-${platform}-${linuxVersion}go-${versionSpec}-${fileHash}`; | ||||
|     const primaryKey = `setup-go-${platform}-${arch}-${linuxVersion}go-${versionSpec}-${fileHash}`; | ||||
|     core.debug(`primary key is ${primaryKey}`); | ||||
|     core.saveState(constants_1.State.CachePrimaryKey, primaryKey); | ||||
|     const cacheKey = yield cache.restoreCache(cachePaths, primaryKey); | ||||
| @@ -88164,7 +88165,11 @@ const getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, | ||||
| exports.getCacheDirectoryPath = getCacheDirectoryPath; | ||||
| function isGhes() { | ||||
|     const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); | ||||
|     return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; | ||||
|     const hostname = ghUrl.hostname.trimEnd().toUpperCase(); | ||||
|     const isGitHubHost = hostname === 'GITHUB.COM'; | ||||
|     const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM'); | ||||
|     const isLocalHost = hostname.endsWith('.LOCALHOST'); | ||||
|     return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost; | ||||
| } | ||||
| exports.isGhes = isGhes; | ||||
| function isCacheFeatureAvailable() { | ||||
|   | ||||
							
								
								
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -4559,12 +4559,12 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/micromatch": { | ||||
|       "version": "4.0.5", | ||||
|       "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", | ||||
|       "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", | ||||
|       "version": "4.0.8", | ||||
|       "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", | ||||
|       "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "braces": "^3.0.2", | ||||
|         "braces": "^3.0.3", | ||||
|         "picomatch": "^2.3.1" | ||||
|       }, | ||||
|       "engines": { | ||||
|   | ||||
| @@ -15,6 +15,7 @@ export const restoreCache = async ( | ||||
| ) => { | ||||
|   const packageManagerInfo = await getPackageManagerInfo(packageManager); | ||||
|   const platform = process.env.RUNNER_OS; | ||||
|   const arch = process.arch; | ||||
|  | ||||
|   const cachePaths = await getCacheDirectoryPath(packageManagerInfo); | ||||
|  | ||||
| @@ -31,7 +32,7 @@ export const restoreCache = async ( | ||||
|  | ||||
|   const linuxVersion = | ||||
|     process.env.RUNNER_OS === 'Linux' ? `${process.env.ImageOS}-` : ''; | ||||
|   const primaryKey = `setup-go-${platform}-${linuxVersion}go-${versionSpec}-${fileHash}`; | ||||
|   const primaryKey = `setup-go-${platform}-${arch}-${linuxVersion}go-${versionSpec}-${fileHash}`; | ||||
|   core.debug(`primary key is ${primaryKey}`); | ||||
|  | ||||
|   core.saveState(State.CachePrimaryKey, primaryKey); | ||||
|   | ||||
| @@ -63,7 +63,13 @@ export function isGhes(): boolean { | ||||
|   const ghUrl = new URL( | ||||
|     process.env['GITHUB_SERVER_URL'] || 'https://github.com' | ||||
|   ); | ||||
|   return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; | ||||
|  | ||||
|   const hostname = ghUrl.hostname.trimEnd().toUpperCase(); | ||||
|   const isGitHubHost = hostname === 'GITHUB.COM'; | ||||
|   const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM'); | ||||
|   const isLocalHost = hostname.endsWith('.LOCALHOST'); | ||||
|  | ||||
|   return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost; | ||||
| } | ||||
|  | ||||
| export function isCacheFeatureAvailable(): boolean { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user