From 03d3ac9155d76bbe34e919a07ca273283ed350ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=80=E9=9D=99=E5=87=A1?= <30424139+wtto00@users.noreply.github.com> Date: Tue, 3 Oct 2023 01:26:15 +0800 Subject: [PATCH 1/4] fix: According to the matrix configuration, configure the cache key. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e483a3..fc5a0a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -144,7 +144,7 @@ jobs: - name: Setup Android SDK uses: ./ with: - cache-key: 'default-version' + cache-key: custom-cache-key-on-${{matrix.os}} - run: | sdkmanager --install emulator From 838b272885bd6263984c3ba9c47910c77549558a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=80=E9=9D=99=E5=87=A1?= <30424139+wtto00@users.noreply.github.com> Date: Tue, 3 Oct 2023 01:27:06 +0800 Subject: [PATCH 2/4] fix: cache console log --- src/cache.ts | 4 ++-- src/installer.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cache.ts b/src/cache.ts index ce2c526..1d51753 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -33,9 +33,9 @@ export async function restoreCache( const restoredEntry = await cache.restoreCache([ANDROID_HOME_DIR], restoreKey) if (restoredEntry) { - core.info(`Found in cache: ${restoredEntry}`) + core.info(`Found in cache: ${restoreKey}`) } else { - core.info(`Not Found cache: ${restoredEntry}`) + core.info(`Not Found cache: ${restoreKey}`) } core.saveState(RESTORED_ENTRY_STATE_KEY, restoredEntry) return Promise.resolve(restoredEntry) diff --git a/src/installer.ts b/src/installer.ts index f60e70a..cddbb10 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -28,7 +28,7 @@ export async function getAndroidSdk( cacheKey ) if (restoreCacheEntry) { - core.info(`cache hit: ${restoreCacheEntry}`) + core.info(`cache hit: ${restoreCacheEntry.key}`) return Promise.resolve() } } From 31079b94cda6ec09e6d2a9ca6fc13930a35b16cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=80=E9=9D=99=E5=87=A1?= <30424139+wtto00@users.noreply.github.com> Date: Tue, 3 Oct 2023 01:38:00 +0800 Subject: [PATCH 3/4] chore: version change adaptation --- README.md | 2 +- src/cache.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f31a78..33f3b92 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ steps: # Whether to use the cache cache-disabled: true - # default: `${sdkVersion}-${buildToolsVersion}-${ndkVersion}-${cmakeVersion}-v3.1` + # default: `${sdkVersion}-${buildToolsVersion}-${ndkVersion}-${cmakeVersion}-v3.2` # Custom key for cache. It is invalid when `cache-disabled: true` cache-key: 'custom-cache-key' diff --git a/src/cache.ts b/src/cache.ts index 1d51753..8d78539 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -13,7 +13,7 @@ function generateRestoreKey( cacheKey: string ): string { if (cacheKey) return cacheKey - return `${sdkVersion}-${buildToolsVersion}-${ndkVersion}-${cmakeVersion}-v3.1` + return `${sdkVersion}-${buildToolsVersion}-${ndkVersion}-${cmakeVersion}-v3.2` } export async function restoreCache( From 630e3755d97cb6145f8748de308001a769a794d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=80=E9=9D=99=E5=87=A1?= <30424139+wtto00@users.noreply.github.com> Date: Tue, 3 Oct 2023 01:46:40 +0800 Subject: [PATCH 4/4] chore: build --- dist/cleanup/index.js | 6 +++--- dist/setup/index.js | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 0a01794..6f63123 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -59646,17 +59646,17 @@ const RESTORED_ENTRY_STATE_KEY = 'restoredEntry'; function generateRestoreKey(sdkVersion, buildToolsVersion, ndkVersion, cmakeVersion, cacheKey) { if (cacheKey) return cacheKey; - return `${sdkVersion}-${buildToolsVersion}-${ndkVersion}-${cmakeVersion}-v3.1`; + return `${sdkVersion}-${buildToolsVersion}-${ndkVersion}-${cmakeVersion}-v3.2`; } function restoreCache(sdkVersion, buildToolsVersion, ndkVersion, cmakeVersion, cacheKey) { return __awaiter(this, void 0, void 0, function* () { const restoreKey = generateRestoreKey(sdkVersion, buildToolsVersion, ndkVersion, cmakeVersion, cacheKey); const restoredEntry = yield cache.restoreCache([constants_1.ANDROID_HOME_DIR], restoreKey); if (restoredEntry) { - core.info(`Found in cache: ${restoredEntry}`); + core.info(`Found in cache: ${restoreKey}`); } else { - core.info(`Not Found cache: ${restoredEntry}`); + core.info(`Not Found cache: ${restoreKey}`); } core.saveState(RESTORED_ENTRY_STATE_KEY, restoredEntry); return Promise.resolve(restoredEntry); diff --git a/dist/setup/index.js b/dist/setup/index.js index 5a51f85..f5eef67 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -60588,17 +60588,17 @@ const RESTORED_ENTRY_STATE_KEY = 'restoredEntry'; function generateRestoreKey(sdkVersion, buildToolsVersion, ndkVersion, cmakeVersion, cacheKey) { if (cacheKey) return cacheKey; - return `${sdkVersion}-${buildToolsVersion}-${ndkVersion}-${cmakeVersion}-v3.1`; + return `${sdkVersion}-${buildToolsVersion}-${ndkVersion}-${cmakeVersion}-v3.2`; } function restoreCache(sdkVersion, buildToolsVersion, ndkVersion, cmakeVersion, cacheKey) { return __awaiter(this, void 0, void 0, function* () { const restoreKey = generateRestoreKey(sdkVersion, buildToolsVersion, ndkVersion, cmakeVersion, cacheKey); const restoredEntry = yield cache.restoreCache([constants_1.ANDROID_HOME_DIR], restoreKey); if (restoredEntry) { - core.info(`Found in cache: ${restoredEntry}`); + core.info(`Found in cache: ${restoreKey}`); } else { - core.info(`Not Found cache: ${restoredEntry}`); + core.info(`Not Found cache: ${restoreKey}`); } core.saveState(RESTORED_ENTRY_STATE_KEY, restoredEntry); return Promise.resolve(restoredEntry); @@ -60740,7 +60740,7 @@ function getAndroidSdk(sdkVersion, buildToolsVersion, ndkVersion, cmakeVersion, if (!cacheDisabled) { const restoreCacheEntry = yield (0, cache_1.restoreCache)(sdkVersion, buildToolsVersion, ndkVersion, cmakeVersion, cacheKey); if (restoreCacheEntry) { - core.info(`cache hit: ${restoreCacheEntry}`); + core.info(`cache hit: ${restoreCacheEntry.key}`); return Promise.resolve(); } }