From 00a63ca6bdf30ab392e7a1adf127c61d2e2fb684 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Sun, 8 Dec 2024 21:59:30 +0000 Subject: [PATCH] switch to use github cache to improve reuse --- .github/actions/setup/action.yml | 17 ++++++++--------- .github/actions/test/action.yml | 6 +++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 2416fcf4..8e4e8392 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -55,14 +55,14 @@ runs: - name: Download CTK cache id: ctk-get-cache - uses: actions/download-artifact@v4 + uses: actions/cache/restore@v4 continue-on-error: true with: - name: ${{ env.CTK_CACHE_KEY }} - path: ./ + key: ${{ env.CTK_CACHE_KEY }} + path: ${{ env.CTK_CACHE_FILENAME }} - name: Get CUDA components - if: ${{ steps.ctk-get-cache.outcome == 'failure' }} + if: ${{ steps.ctk-get-cache.outputs.cache-hit != 'true' }} shell: bash --noprofile --norc -xeuo pipefail {0} run: | CUDA_PATH="./cuda_toolkit" @@ -123,16 +123,15 @@ runs: # so setting the CUDA_PATH env var here is meaningless. - name: Upload CTK cache - if: ${{ steps.ctk-get-cache.outcome == 'failure' }} - uses: actions/upload-artifact@v4 - continue-on-error: true + if: ${{ always() && + steps.ctk-get-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@v4 with: name: ${{ env.CTK_CACHE_KEY }} path: ./${{ env.CTK_CACHE_FILENAME }} - if-no-files-found: error - name: Restore CTK cache - if: ${{ steps.ctk-get-cache.outcome == 'success' }} + if: ${{ steps.ctk-get-cache.outputs.cache-hit == 'true' }} shell: bash --noprofile --norc -xeuo pipefail {0} run: | ls -l diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 78572917..3737e789 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -51,11 +51,11 @@ runs: - name: Download CTK cache id: ctk-get-cache - uses: actions/download-artifact@v4 + uses: actions/cache/restore@v4 continue-on-error: true with: - name: ${{ env.CTK_CACHE_KEY }} - path: ./ + key: ${{ env.CTK_CACHE_KEY }} + path: ${{ env.CTK_CACHE_FILENAME }} - name: Restore CTK cache shell: bash --noprofile --norc -xeuo pipefail {0}