mirror of
				https://github.com/Swatinem/rust-cache.git
				synced 2025-10-31 23:53:48 +00:00 
			
		
		
		
	Merge 5d260ed8469e8bd8f84a205ea4199713bde7c31e into 9bdad043e88c75890e36ad3bbc8d27f0090dd609
This commit is contained in:
		
						commit
						b6b776b21b
					
				
							
								
								
									
										32
									
								
								.github/workflows/blacksmith.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								.github/workflows/blacksmith.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | ||||
| name: blacksmith | ||||
| 
 | ||||
| on: [push, pull_request] | ||||
| 
 | ||||
| jobs: | ||||
|   blacksmith: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, macos-latest, windows-latest] | ||||
| 
 | ||||
|     name: Test blacksmith provider on ${{ matrix.os }} | ||||
|     runs-on: ${{ matrix.os }} | ||||
| 
 | ||||
|     env: | ||||
|       CARGO_TERM_COLOR: always | ||||
| 
 | ||||
|     steps: | ||||
|       - uses: actions/checkout@v3 | ||||
| 
 | ||||
|       - run: rustup toolchain install stable --profile minimal --no-self-update | ||||
| 
 | ||||
|       - uses: ./ | ||||
|         with: | ||||
|           workspaces: tests | ||||
|           cache-provider: blacksmith | ||||
| 
 | ||||
|       - run: | | ||||
|           cargo check | ||||
|           cargo test | ||||
|           cargo build --release | ||||
|         working-directory: tests | ||||
| @ -12,7 +12,7 @@ sensible defaults. | ||||
| # before the plugin, as the cache uses the current rustc version as its cache key | ||||
| - run: rustup toolchain install stable --profile minimal | ||||
| 
 | ||||
| - uses: Swatinem/rust-cache@v2 | ||||
| - uses: useblacksmith/rust-cache@v3 | ||||
|   with: | ||||
|     # The prefix cache key, this can be changed to start a new cache manually. | ||||
|     # default: "v0-rust" | ||||
| @ -70,8 +70,8 @@ sensible defaults. | ||||
|     save-if: ${{ github.ref == 'refs/heads/master' }} | ||||
| 
 | ||||
|     # Specifies what to use as the backend providing cache | ||||
|     # Can be set to either "github" or "buildjet" | ||||
|     # default: "github" | ||||
|     # Can be set to either "github" or "blacksmith" | ||||
|     # default: "blacksmith" | ||||
|     cache-provider: "" | ||||
| ``` | ||||
| 
 | ||||
|  | ||||
| @ -37,9 +37,9 @@ inputs: | ||||
|     required: false | ||||
|     default: "true" | ||||
|   cache-provider: | ||||
|     description: "Determines which provider to use for caching. Options are github or buildjet, defaults to github." | ||||
|     description: "Determines which provider to use for caching. Options are github or blacksmith, defaults to blacksmith." | ||||
|     required: false | ||||
|     default: "github" | ||||
|     default: "blacksmith" | ||||
| outputs: | ||||
|   cache-hit: | ||||
|     description: "A boolean value that indicates an exact match was found." | ||||
|  | ||||
							
								
								
									
										2859
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2859
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2859
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2859
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										28
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										28
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -9,6 +9,7 @@ | ||||
|       "version": "2.7.3", | ||||
|       "license": "LGPL-3.0", | ||||
|       "dependencies": { | ||||
|         "@actions/blacksmith-cache": "npm:@useblacksmith/cache@3.2.48", | ||||
|         "@actions/buildjet-cache": "npm:github-actions.cache-buildjet@0.2.0", | ||||
|         "@actions/cache": "^3.2.4", | ||||
|         "@actions/core": "^1.10.1", | ||||
| @ -26,6 +27,33 @@ | ||||
|         "url": "https://github.com/sponsors/Swatinem" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@actions/blacksmith-cache": { | ||||
|       "name": "@useblacksmith/cache", | ||||
|       "version": "3.2.48", | ||||
|       "resolved": "https://registry.npmjs.org/@useblacksmith/cache/-/cache-3.2.48.tgz", | ||||
|       "integrity": "sha512-w9uGDYKXHi4MyOrL60COMrHgYA9LBYRFbw1whGR0Ve8oRlQ9PfmOKEe2v9VT/65E/S3Wni/TGwhgMI0RBEoSmw==", | ||||
|       "dependencies": { | ||||
|         "@actions/core": "^1.10.0", | ||||
|         "@actions/exec": "^1.0.1", | ||||
|         "@actions/glob": "^0.1.0", | ||||
|         "@actions/http-client": "^2.1.1", | ||||
|         "@actions/io": "^1.0.1", | ||||
|         "@azure/abort-controller": "^1.1.0", | ||||
|         "@azure/ms-rest-js": "^2.6.0", | ||||
|         "@azure/storage-blob": "^12.13.0", | ||||
|         "semver": "^6.1.0", | ||||
|         "uuid": "^3.3.3" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@actions/blacksmith-cache/node_modules/@actions/glob": { | ||||
|       "version": "0.1.2", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.2.tgz", | ||||
|       "integrity": "sha512-SclLR7Ia5sEqjkJTPs7Sd86maMDw43p769YxBOxvPvEWuPEhpAnBsQfENOpXjFYMmhCqd127bmf+YdvJqVqR4A==", | ||||
|       "dependencies": { | ||||
|         "@actions/core": "^1.2.6", | ||||
|         "minimatch": "^3.0.4" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@actions/buildjet-cache": { | ||||
|       "name": "github-actions.cache-buildjet", | ||||
|       "version": "0.2.0", | ||||
|  | ||||
| @ -22,6 +22,7 @@ | ||||
|   }, | ||||
|   "homepage": "https://github.com/Swatinem/rust-cache#readme", | ||||
|   "dependencies": { | ||||
|     "@actions/blacksmith-cache": "npm:@useblacksmith/cache@3.2.48", | ||||
|     "@actions/buildjet-cache": "npm:github-actions.cache-buildjet@0.2.0", | ||||
|     "@actions/cache": "^3.2.4", | ||||
|     "@actions/core": "^1.10.1", | ||||
|  | ||||
							
								
								
									
										12
									
								
								src/utils.ts
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/utils.ts
									
									
									
									
									
								
							| @ -2,6 +2,7 @@ import * as core from "@actions/core"; | ||||
| import * as exec from "@actions/exec"; | ||||
| import * as buildjetCache from "@actions/buildjet-cache"; | ||||
| import * as ghCache from "@actions/cache"; | ||||
| import * as bsCache from "@actions/blacksmith-cache"; | ||||
| import fs from "fs"; | ||||
| 
 | ||||
| export function reportError(e: any) { | ||||
| @ -17,7 +18,7 @@ export function reportError(e: any) { | ||||
| export async function getCmdOutput( | ||||
|   cmd: string, | ||||
|   args: Array<string> = [], | ||||
|   options: exec.ExecOptions = {}, | ||||
|   options: exec.ExecOptions = {} | ||||
| ): Promise<string> { | ||||
|   let stdout = ""; | ||||
|   let stderr = ""; | ||||
| @ -51,7 +52,14 @@ export interface CacheProvider { | ||||
| 
 | ||||
| export function getCacheProvider(): CacheProvider { | ||||
|   const cacheProvider = core.getInput("cache-provider"); | ||||
|   const cache = cacheProvider === "github" ? ghCache : cacheProvider === "buildjet" ? buildjetCache : undefined; | ||||
|   const cache = | ||||
|     cacheProvider === "github" | ||||
|       ? ghCache | ||||
|       : cacheProvider === "buildjet" | ||||
|       ? buildjetCache | ||||
|       : cacheProvider === "blacksmith" | ||||
|       ? bsCache | ||||
|       : undefined; | ||||
| 
 | ||||
|   if (!cache) { | ||||
|     throw new Error(`The \`cache-provider\` \`{cacheProvider}\` is not valid.`); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user