Skip to content

Commit

Permalink
[github-actions] cache git LFS directory (#336)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lmnotran authored and bertoldi-silabs committed Oct 12, 2022
1 parent 9bafd04 commit 0cd1712
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0cd1712

Please sign in to comment.