mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 18:34:19 +08:00 
			
		
		
		
	Added a cache example when using matrix
This commit is contained in:
		
							parent
							
								
									9f3a4d3e65
								
							
						
					
					
						commit
						72f66cfa6d
					
				
							
								
								
									
										25
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								examples.md
									
									
									
									
									
								
							| @ -345,6 +345,31 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu. | |||||||
|       ${{ runner.os }}-pip- |       ${{ runner.os }}-pip- | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
|  | ### Multiple OS's in a workflow with a matrix | ||||||
|  | 
 | ||||||
|  | ``` yaml | ||||||
|  | jobs: | ||||||
|  |   build: | ||||||
|  |     runs-on: ${{ matrix.os }} | ||||||
|  |     strategy: | ||||||
|  |       matrix: | ||||||
|  |         os: [ubuntu-latest, macos-latest, windows-latest] | ||||||
|  |         include: | ||||||
|  |         - os: ubuntu-latest | ||||||
|  |           path: ~/.cache/pip | ||||||
|  |         - os: macos-latest | ||||||
|  |           path: ~/Library/Caches/pip | ||||||
|  |         - os: windows-latest | ||||||
|  |           path: ~\AppData\Local\pip\Cache | ||||||
|  |     steps: | ||||||
|  |     - uses: actions/cache@v2 | ||||||
|  |       with: | ||||||
|  |         path: ${{ matrix.path }} | ||||||
|  |         key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||||||
|  |         restore-keys: | | ||||||
|  |          ${{ runner.os }}-pip- | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
| ### Using pip to get cache location | ### Using pip to get cache location | ||||||
| 
 | 
 | ||||||
| > Note: This requires pip 20.1+ | > Note: This requires pip 20.1+ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Chris Patterson
						Chris Patterson