Merge pull request #411 from galargh/fix/windows-hostedtoolcache
Fix hosted tool cache usage on windows
This commit is contained in:
		
						commit
						d085b4fe57
					
				
							
								
								
									
										22
									
								
								.github/workflows/windows-validation.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								.github/workflows/windows-validation.yml
									
									
									
									
										vendored
									
									
								
							| @ -112,3 +112,25 @@ jobs: | ||||
|             exit 1 | ||||
|           fi | ||||
|         shell: bash | ||||
| 
 | ||||
|   hostedtoolcache: | ||||
|     name: 'Validate if hostedtoolcache works as expected' | ||||
|     runs-on: windows-latest | ||||
|     strategy: | ||||
|       matrix: | ||||
|         cache: [false] | ||||
|         go: [1.20.1] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v3 | ||||
| 
 | ||||
|       - name: 'Setup ${{ matrix.go }}, cache: ${{ matrix.cache }}' | ||||
|         uses: ./ | ||||
|         with: | ||||
|           go-version: ${{ matrix.go }} | ||||
|           cache: ${{ matrix.cache }} | ||||
| 
 | ||||
|       - name: 'Setup ${{ matrix.go }}, cache: ${{ matrix.cache }} (from hostedtoolcache)' | ||||
|         uses: ./ | ||||
|         with: | ||||
|           go-version: ${{ matrix.go }} | ||||
|           cache: ${{ matrix.cache }} | ||||
|  | ||||
							
								
								
									
										4
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							| @ -61514,6 +61514,10 @@ function cacheWindowsDir(extPath, tool, version, arch) { | ||||
|         fs_1.default.mkdirSync(path.dirname(defaultToolCacheDir), { recursive: true }); | ||||
|         fs_1.default.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); | ||||
|         core.info(`Created link ${defaultToolCacheDir} => ${actualToolCacheDir}`); | ||||
|         const actualToolCacheCompleteFile = `${actualToolCacheDir}.complete`; | ||||
|         const defaultToolCacheCompleteFile = `${defaultToolCacheDir}.complete`; | ||||
|         fs_1.default.symlinkSync(actualToolCacheCompleteFile, defaultToolCacheCompleteFile, 'file'); | ||||
|         core.info(`Created link ${defaultToolCacheCompleteFile} => ${actualToolCacheCompleteFile}`); | ||||
|         // make outer code to continue using toolcache as if it were installed on c:
 | ||||
|         // restore toolcache root to default drive c:
 | ||||
|         process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot; | ||||
|  | ||||
| @ -203,6 +203,17 @@ async function cacheWindowsDir( | ||||
|   fs.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); | ||||
|   core.info(`Created link ${defaultToolCacheDir} => ${actualToolCacheDir}`); | ||||
| 
 | ||||
|   const actualToolCacheCompleteFile = `${actualToolCacheDir}.complete`; | ||||
|   const defaultToolCacheCompleteFile = `${defaultToolCacheDir}.complete`; | ||||
|   fs.symlinkSync( | ||||
|     actualToolCacheCompleteFile, | ||||
|     defaultToolCacheCompleteFile, | ||||
|     'file' | ||||
|   ); | ||||
|   core.info( | ||||
|     `Created link ${defaultToolCacheCompleteFile} => ${actualToolCacheCompleteFile}` | ||||
|   ); | ||||
| 
 | ||||
|   // make outer code to continue using toolcache as if it were installed on c:
 | ||||
|   // restore toolcache root to default drive c:
 | ||||
|   process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user