Skip to content

Commit

Permalink
Use cache for LFS files in GitHub actions
Browse files Browse the repository at this point in the history
This is to reduce the required LFS bandwidth of the GitHub actions.
The solution is based on
actions/checkout#165 (comment)
  • Loading branch information
albertziegenhagel committed May 1, 2024
1 parent 33eb6e1 commit 46925c5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,21 @@ jobs:
- uses: actions/checkout@v4
with:
lfs: 'true'
lfs: 'false'

- name: Create LFS file list
shell: pwsh
run: git lfs ls-files -l | ForEach-Object { $_.split(" ")[0] } | Sort-Object | Out-File .lfs-assets-id

- name: Restore LFS cache
uses: actions/cache@v4
id: lfs-cache
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1

- name: Git LFS Pull
run: git lfs pull

- uses: lukka/get-cmake@latest
with:
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,21 @@ jobs:
- uses: actions/checkout@v4
with:
lfs: 'true'
lfs: 'false'

- name: Create LFS file list
shell: pwsh
run: git lfs ls-files -l | ForEach-Object { $_.split(" ")[0] } | Sort-Object | Out-File .lfs-assets-id

- name: Restore LFS cache
uses: actions/cache@v4
id: lfs-cache
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1

- name: Git LFS Pull
run: git lfs pull

- uses: lukka/get-cmake@latest
with:
Expand Down

0 comments on commit 46925c5

Please sign in to comment.