mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 15:48:39 +08:00 
			
		
		
		
	Add renv examples
This commit is contained in:
		
							parent
							
								
									6c11532937
								
							
						
					
					
						commit
						2c204d5c09
					
				
							
								
								
									
										50
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								examples.md
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -10,6 +10,7 @@
 | 
			
		|||
- [Node - Yarn](#node---yarn)
 | 
			
		||||
- [PHP - Composer](#php---composer)
 | 
			
		||||
- [Python - pip](#python---pip)
 | 
			
		||||
- [R - renv](#r---renv)
 | 
			
		||||
- [Ruby - Bundler](#ruby---bundler)
 | 
			
		||||
- [Rust - Cargo](#rust---cargo)
 | 
			
		||||
- [Scala - SBT](#scala---sbt)
 | 
			
		||||
| 
						 | 
				
			
			@ -248,6 +249,55 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu.
 | 
			
		|||
      ${{ runner.os }}-pip-
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## R - renv
 | 
			
		||||
 | 
			
		||||
For renv, the cache directory will vary by OS. Look at https://rstudio.github.io/renv/articles/renv.html#cache
 | 
			
		||||
 | 
			
		||||
Locations:
 | 
			
		||||
 - Ubuntu: `~/.local/share/renv`
 | 
			
		||||
 - macOS: `~/Library/Application Support/renv`
 | 
			
		||||
 - Windows: `%LOCALAPPDATA%/renv`
 | 
			
		||||
 | 
			
		||||
### Simple example
 | 
			
		||||
```yaml
 | 
			
		||||
- uses: actions/cache@v1
 | 
			
		||||
  with:
 | 
			
		||||
    path: ~/.local/share/renv
 | 
			
		||||
    key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
 | 
			
		||||
    restore-keys: |
 | 
			
		||||
      ${{ runner.os }}-renv-
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Replace `~/.local/share/renv` with the correct `path` if not using Ubuntu.
 | 
			
		||||
 | 
			
		||||
### Multiple OS's in a workflow
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- uses: actions/cache@v1
 | 
			
		||||
  if: startsWith(runner.os, 'Linux')
 | 
			
		||||
  with:
 | 
			
		||||
    path: ~/.local/share/renv
 | 
			
		||||
    key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
 | 
			
		||||
    restore-keys: |
 | 
			
		||||
      ${{ runner.os }}-renv-
 | 
			
		||||
 | 
			
		||||
- uses: actions/cache@v1
 | 
			
		||||
  if: startsWith(runner.os, 'macOS')
 | 
			
		||||
  with:
 | 
			
		||||
    path: ~/Library/Application Support/renv
 | 
			
		||||
    key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
 | 
			
		||||
    restore-keys: |
 | 
			
		||||
      ${{ runner.os }}-renv-
 | 
			
		||||
 | 
			
		||||
- uses: actions/cache@v1
 | 
			
		||||
  if: startsWith(runner.os, 'Windows')
 | 
			
		||||
  with:
 | 
			
		||||
    path: ~\AppData\Local\renv
 | 
			
		||||
    key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
 | 
			
		||||
    restore-keys: |
 | 
			
		||||
      ${{ runner.os }}-renv-
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Ruby - Bundler
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user