mirror of
				https://github.com/Swatinem/rust-cache.git
				synced 2025-10-31 23:03:48 +00:00 
			
		
		
		
	Add cache-workspace-crates feature (#246)
This commit is contained in:
		
							parent
							
								
									901019c0f8
								
							
						
					
					
						commit
						eaa85be6b1
					
				| @ -60,6 +60,12 @@ sensible defaults. | |||||||
|     # default: "false" |     # default: "false" | ||||||
|     cache-all-crates: "" |     cache-all-crates: "" | ||||||
| 
 | 
 | ||||||
|  |     # Similar to cache-all-crates. | ||||||
|  |     # If `true` the workspace crates will be cached. | ||||||
|  |     # Useful if the workspace contains libraries that are only updated sporadically. | ||||||
|  |     # default: "false" | ||||||
|  |     cache-workspace-crates: "" | ||||||
|  | 
 | ||||||
|     # Determines whether the cache should be saved. |     # Determines whether the cache should be saved. | ||||||
|     # If `false`, the cache is only restored. |     # If `false`, the cache is only restored. | ||||||
|     # Useful for jobs where the matrix is additive e.g. additional Cargo features, |     # Useful for jobs where the matrix is additive e.g. additional Cargo features, | ||||||
|  | |||||||
| @ -32,6 +32,10 @@ inputs: | |||||||
|     description: "Determines which crates are cached. If `true` all crates will be cached, otherwise only dependent crates will be cached." |     description: "Determines which crates are cached. If `true` all crates will be cached, otherwise only dependent crates will be cached." | ||||||
|     required: false |     required: false | ||||||
|     default: "false" |     default: "false" | ||||||
|  |   cache-workspace-crates: | ||||||
|  |     description: "Similar to cache-all-crates. If `true` the workspace crates will be cached." | ||||||
|  |     required: false | ||||||
|  |     default: "false" | ||||||
|   save-if: |   save-if: | ||||||
|     description: "Determiners whether the cache should be saved. If `false`, the cache is only restored." |     description: "Determiners whether the cache should be saved. If `false`, the cache is only restored." | ||||||
|     required: false |     required: false | ||||||
|  | |||||||
							
								
								
									
										5
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							| @ -87340,9 +87340,14 @@ async function run() { | |||||||
|         if (process.env["RUNNER_OS"] == "macOS") { |         if (process.env["RUNNER_OS"] == "macOS") { | ||||||
|             await macOsWorkaround(); |             await macOsWorkaround(); | ||||||
|         } |         } | ||||||
|  |         const workspaceCrates = core.getInput("cache-workspace-crates").toLowerCase() || "false"; | ||||||
|         const allPackages = []; |         const allPackages = []; | ||||||
|         for (const workspace of config.workspaces) { |         for (const workspace of config.workspaces) { | ||||||
|             const packages = await workspace.getPackagesOutsideWorkspaceRoot(); |             const packages = await workspace.getPackagesOutsideWorkspaceRoot(); | ||||||
|  |             if (workspaceCrates === "true") { | ||||||
|  |                 const wsMembers = await workspace.getWorkspaceMembers(); | ||||||
|  |                 packages.push(...wsMembers); | ||||||
|  |             } | ||||||
|             allPackages.push(...packages); |             allPackages.push(...packages); | ||||||
|             try { |             try { | ||||||
|                 core.info(`... Cleaning ${workspace.target} ...`); |                 core.info(`... Cleaning ${workspace.target} ...`); | ||||||
|  | |||||||
| @ -36,9 +36,14 @@ async function run() { | |||||||
|       await macOsWorkaround(); |       await macOsWorkaround(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     const workspaceCrates = core.getInput("cache-workspace-crates").toLowerCase() || "false"; | ||||||
|     const allPackages = []; |     const allPackages = []; | ||||||
|     for (const workspace of config.workspaces) { |     for (const workspace of config.workspaces) { | ||||||
|       const packages = await workspace.getPackagesOutsideWorkspaceRoot(); |       const packages = await workspace.getPackagesOutsideWorkspaceRoot(); | ||||||
|  |       if (workspaceCrates === "true") { | ||||||
|  |         const wsMembers = await workspace.getWorkspaceMembers(); | ||||||
|  |         packages.push(...wsMembers); | ||||||
|  |       } | ||||||
|       allPackages.push(...packages); |       allPackages.push(...packages); | ||||||
|       try { |       try { | ||||||
|         core.info(`... Cleaning ${workspace.target} ...`); |         core.info(`... Cleaning ${workspace.target} ...`); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user