mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 15:48:39 +08:00 
			
		
		
		
	Add how-to handle Jest cache
This commit is contained in:
		
							parent
							
								
									6bbe742add
								
							
						
					
					
						commit
						eff961eb07
					
				
							
								
								
									
										19
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								examples.md
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -19,6 +19,7 @@
 | 
			
		|||
- [Node - Lerna](#node---lerna)
 | 
			
		||||
- [Node - Yarn](#node---yarn)
 | 
			
		||||
- [Node - Yarn 2](#node---yarn-2)
 | 
			
		||||
- [Node - Jest](#node---jest)
 | 
			
		||||
- [OCaml/Reason - esy](#ocamlreason---esy)
 | 
			
		||||
- [PHP - Composer](#php---composer)
 | 
			
		||||
- [Python - pip](#python---pip)
 | 
			
		||||
| 
						 | 
				
			
			@ -295,6 +296,24 @@ The yarn 2 cache directory will depend on your config. See https://yarnpkg.com/c
 | 
			
		|||
      ${{ runner.os }}-yarn-
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Node - Jest
 | 
			
		||||
The Jest cache directory will depend on your config. See https://jestjs.io/docs/cli#--cache for more info.
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: Get Jest cache directory path
 | 
			
		||||
  id: jest-cache-dir-path
 | 
			
		||||
  run: |
 | 
			
		||||
    JEST_CACHE_DIR=$(yarn jest --showConfig | grep -o '"cacheDirectory": "[^"]*' | grep -o '[^"]*$')
 | 
			
		||||
    echo "::set-output name=dir::$JEST_CACHE_DIR"
 | 
			
		||||
 | 
			
		||||
- uses: actions/cache@v2
 | 
			
		||||
  with:
 | 
			
		||||
    path: ${{ steps.jest-cache-dir-path.outputs.dir }}
 | 
			
		||||
    key: ${{ runner.os }}-jest-${{ github.sha }}
 | 
			
		||||
    restore-keys: |
 | 
			
		||||
      ${{ runner.os }}-jest-
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## OCaml/Reason - esy
 | 
			
		||||
 | 
			
		||||
Esy allows you to export built dependencies and import pre-built dependencies.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user