From 0cd1712097a01b5a0e0aa06d74b61741102089ad Mon Sep 17 00:00:00 2001 From: Mason Tran Date: Thu, 23 Jun 2022 20:54:14 -0400 Subject: [PATCH] [github-actions] cache git LFS directory (#336) We've used ~5.3TB of bandwidth in the last month. This is because every GitHub action is pulling the Git LFS objects unconditionally and with `lfs: true` doesn't cache pulled LFS objects by default. The implementation is from: actions/checkout#165 --- .github/workflows/build.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 920502e6..15790801 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,7 +92,20 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - lfs: true + + - name: Create LFS file hash list + run: git -C third_party/silabs/gecko_sdk lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id + + - name: Restore gecko_sdk LFS cache + uses: actions/cache@v2 + id: lfs-cache + with: + path: .git/modules/third_party/silabs/gecko_sdk/lfs + key: lfs-${{ hashFiles('.lfs-assets-id') }} + + - name: Git LFS Pull + run: git -C third_party/silabs/gecko_sdk lfs pull + - uses: actions/setup-java@v3 with: distribution: 'temurin' # See 'Supported distributions' for available options