From 4e23dc54259ac9fae576e9ed934b8d42173d8923 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Wed, 5 Mar 2025 14:56:28 +0000 Subject: [PATCH] Refactor LFS handling (#881) See https://github.com/linebender/vello/pull/833 --- .github/workflows/ci.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf4daab59..425e8c5d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,8 @@ env: ANDROID_TARGETS: "-p xilem --example mason_android --example calc_android --example stopwatch_android --example variable_clock_android --example http_cats_android --example to_do_mvc_android" # Whether the workspace contains Rust code using the debug_assertions configuration option. USING_DEBUG_ASSERTIONS: "true" + # The files stored in LFS the tests need to access + LFS_FILES: "masonry/src/**/screenshots/*.png" # Rationale @@ -206,23 +208,29 @@ jobs: name: Prime LFS Cache runs-on: ubuntu-latest continue-on-error: true + outputs: + lfs-hash: ${{ steps.calc-hash.outputs.result }} steps: - name: Checkout repository uses: actions/checkout@v4 + - id: calc-hash + name: Calculate LFS hash + run: echo "result=${{ hashFiles(env.LFS_FILES) }}" | tee -a "$GITHUB_OUTPUT" + - name: Cache git LFS id: lfs-cache uses: actions/cache@v4 with: path: .git/lfs # The files stored in git lfs are all in this folder - key: masonry-lfs-${{ hashFiles('masonry/src/**/screenshots/*.png') }} + key: masonry-lfs-${{ steps.calc-hash.outputs.result }} restore-keys: masonry-lfs- enableCrossOsArchive: true - name: Fetch LFS data if: ${{ steps.lfs-cache.outputs.cache-hit != 'true' }} - run: git lfs fetch + run: git lfs fetch --include '${{ env.LFS_FILES }}' test-stable: name: cargo test @@ -251,11 +259,11 @@ jobs: with: path: .git/lfs # The files stored in git lfs are all in this folder - key: masonry-lfs-${{ hashFiles('masonry/src/**/screenshots/*.png') }} + key: masonry-lfs-${{ needs.prime-lfs-cache.outputs.lfs-hash }} enableCrossOsArchive: true - name: Checkout LFS files - run: git lfs checkout + run: git lfs checkout '${{ env.LFS_FILES }}' continue-on-error: true - name: Install Rust ${{ env.RUST_STABLE_VER }}