chore(travis): add npm/install-dependencies.sh step in preparation for caching
This commit is contained in:
		
							parent
							
								
									eb87f5f851
								
							
						
					
					
						commit
						371c8b8a1c
					
				
							
								
								
									
										10
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								.travis.yml
									
									
									
									
									
								
							| @ -28,12 +28,22 @@ before_install: | |||||||
| - ./scripts/ci/install_dart.sh ${DART_CHANNEL} ${ARCH} | - ./scripts/ci/install_dart.sh ${DART_CHANNEL} ${ARCH} | ||||||
| - sh -e /etc/init.d/xvfb start | - sh -e /etc/init.d/xvfb start | ||||||
| - if [[ -e SKIP_TRAVIS_TESTS ]]; then { cat SKIP_TRAVIS_TESTS ; exit 0; } fi | - if [[ -e SKIP_TRAVIS_TESTS ]]; then { cat SKIP_TRAVIS_TESTS ; exit 0; } fi | ||||||
|  | 
 | ||||||
|  | install: | ||||||
|  |   # Check the size of caches | ||||||
|  |   - du -sh ./node_modules || true | ||||||
|  |   # Install npm dependecies and ensure that npm cache is not stale | ||||||
|  |   - tools/npm/install-dependencies.sh | ||||||
|  | 
 | ||||||
| before_script: | before_script: | ||||||
| - mkdir -p $LOGS_DIR | - mkdir -p $LOGS_DIR | ||||||
|  | 
 | ||||||
| script: | script: | ||||||
| - ./scripts/ci/build_and_test.sh ${MODE} | - ./scripts/ci/build_and_test.sh ${MODE} | ||||||
|  | 
 | ||||||
| after_script: | after_script: | ||||||
| - ./scripts/ci/print-logs.sh | - ./scripts/ci/print-logs.sh | ||||||
|  | 
 | ||||||
| notifications: | notifications: | ||||||
|   webhooks: |   webhooks: | ||||||
|     urls: |     urls: | ||||||
|  | |||||||
							
								
								
									
										16
									
								
								tools/npm/install-dependencies.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										16
									
								
								tools/npm/install-dependencies.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | 
 | ||||||
|  | set -e | ||||||
|  | 
 | ||||||
|  | SHRINKWRAP_FILE=npm-shrinkwrap.json | ||||||
|  | SHRINKWRAP_CACHED_FILE=node_modules/npm-shrinkwrap.cached.json | ||||||
|  | 
 | ||||||
|  | if diff -q $SHRINKWRAP_FILE $SHRINKWRAP_CACHED_FILE; then | ||||||
|  |   echo 'No shrinkwrap changes detected. npm install will be skipped...'; | ||||||
|  | else | ||||||
|  |   echo 'Blowing away node_modules and reinstalling npm dependencies...' | ||||||
|  |   rm -rf node_modules | ||||||
|  |   npm install | ||||||
|  |   cp $SHRINKWRAP_FILE $SHRINKWRAP_CACHED_FILE | ||||||
|  |   echo 'npm install successful!' | ||||||
|  | fi | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user