WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 8aad064

Browse files
Use primed OS independent LFS caching
1 parent 06d30b2 commit 8aad064

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

.github/workflows/build-and-test.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,40 @@ on:
1212
- main
1313
- release/*
1414
types: [ labeled, opened, synchronize, reopened ]
15+
1516
jobs:
17+
# Primes the LFS cache so all matrix jobs can restore it in the same workflow run
18+
WarmLfs:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Git Config
22+
shell: bash
23+
run: |
24+
git config --global core.autocrlf false
25+
git config --global core.longpaths true
26+
27+
- name: Git Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
submodules: recursive
32+
33+
# See https://github.com/actions/checkout/issues/165#issuecomment-657673315
34+
- name: Git Create LFS FileList
35+
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
36+
37+
- name: Git Setup LFS Cache
38+
uses: actions/cache@v4
39+
id: lfs-cache
40+
with:
41+
path: .git/lfs
42+
key: lfs-${{ hashFiles('.lfs-assets-id') }}-v1
43+
44+
- name: Git Pull LFS
45+
run: git lfs pull
46+
1647
Build:
48+
needs: WarmLfs # Ensure the cache is saved before starting the matrix
1749
strategy:
1850
matrix:
1951
isARM:
@@ -90,7 +122,7 @@ jobs:
90122
fetch-depth: 0
91123
submodules: recursive
92124

93-
# See https://github.com/actions/checkout/issues/165#issuecomment-657673315
125+
# Each job restores the now-primed cache, and pulls only if needed
94126
- name: Git Create LFS FileList
95127
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
96128

@@ -99,7 +131,7 @@ jobs:
99131
id: lfs-cache
100132
with:
101133
path: .git/lfs
102-
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1
134+
key: lfs-${{ hashFiles('.lfs-assets-id') }}-v1
103135

104136
- name: Git Pull LFS
105137
run: git lfs pull
@@ -213,4 +245,3 @@ jobs:
213245
run: |
214246
dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate
215247
dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate
216-

.github/workflows/code-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
id: lfs-cache
4646
with:
4747
path: .git/lfs
48-
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1
48+
key: lfs-${{ hashFiles('.lfs-assets-id') }}-v1
4949

5050
- name: Git Pull LFS
5151
run: git lfs pull

0 commit comments

Comments
 (0)