mirror of
				https://github.com/Swatinem/rust-cache.git
				synced 2025-10-31 16:03:48 +00:00 
			
		
		
		
	better logging, better staging
This commit is contained in:
		
							parent
							
								
									a0f80e7b74
								
							
						
					
					
						commit
						70758ffdc7
					
				| @ -79,11 +79,15 @@ async function cleanProfileTarget(profileDir: string, packages: Packages, checkT | ||||
|     await fillModifiedTimes(incrementalDir); | ||||
| 
 | ||||
|     // Write the modified times to the incremental folder
 | ||||
|     core.debug(`writing incremental-restore.json for ${incrementalDir} with ${modifiedTimes} files`); | ||||
|     core.debug(`writing incremental-restore.json for ${incrementalDir} files`); | ||||
|     for (const file of modifiedTimes.keys()) { | ||||
|       core.debug(`  ${file} -> ${modifiedTimes.get(file)}`); | ||||
|     } | ||||
|     const contents = JSON.stringify({ modifiedTimes }); | ||||
|     await fs.promises.writeFile(path.join(incrementalDir, "incremental-restore.json"), contents); | ||||
|   } | ||||
| 
 | ||||
| 
 | ||||
|   await rmExcept(profileDir, keepProfile); | ||||
| 
 | ||||
|   const keepPkg = new Set(packages.map((p) => p.name)); | ||||
|  | ||||
							
								
								
									
										15
									
								
								src/save.ts
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								src/save.ts
									
									
									
									
									
								
							| @ -4,6 +4,7 @@ import * as exec from "@actions/exec"; | ||||
| import { cleanBin, cleanGit, cleanRegistry, cleanTargetDir } from "./cleanup"; | ||||
| import { CacheConfig, isCacheUpToDate } from "./config"; | ||||
| import { getCacheProvider, reportError } from "./utils"; | ||||
| import { rm } from "fs/promises"; | ||||
| 
 | ||||
| process.on("uncaughtException", (e) => { | ||||
|   core.error(e.message); | ||||
| @ -72,16 +73,22 @@ async function run() { | ||||
|       core.debug(`${(e as any).stack}`); | ||||
|     } | ||||
| 
 | ||||
|     // Save the incremental cache before we delete it
 | ||||
|     if (config.incremental) { | ||||
|       core.info(`... Saving incremental cache ...`); | ||||
|       await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey); | ||||
|       for (const path of config.incrementalPaths) { | ||||
|         core.debug(`  deleting ${path}`); | ||||
|         await rm(path); | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     core.info(`... Saving cache ...`); | ||||
|     // Pass a copy of cachePaths to avoid mutating the original array as reported by:
 | ||||
|     // https://github.com/actions/toolkit/pull/1378
 | ||||
|     // TODO: remove this once the underlying bug is fixed.
 | ||||
|     await cacheProvider.cache.saveCache(config.cachePaths.slice(), config.cacheKey); | ||||
| 
 | ||||
|     if (config.incremental) { | ||||
|       core.info(`... Saving incremental cache ...`); | ||||
|       await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey); | ||||
|     } | ||||
|   } catch (e) { | ||||
|     reportError(e); | ||||
|   } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user