File tree Expand file tree Collapse file tree 6 files changed +63
-20
lines changed Expand file tree Collapse file tree 6 files changed +63
-20
lines changed Original file line number Diff line number Diff line change 1+ name : ' LFS Cache Handler'
2+ description : ' Caches and restores LFS objects to reduce bandwidth usage'
3+ inputs :
4+ lfs_enabled :
5+ description : ' Whether LFS is used in this repository'
6+ required : false
7+ default : ' true'
8+ ref : # Add this new input
9+ description : ' Git ref to checkout'
10+ required : false
11+ runs :
12+ using : " composite"
13+ steps :
14+ - name : Checkout (LFS disabled)
15+ if : ${{ inputs.lfs_enabled == 'true' }}
16+ uses : actions/checkout@v4
17+ with :
18+ lfs : false
19+ ref : ${{ inputs.ref }}
20+
21+ - name : Generate LFS hash list
22+ if : ${{ inputs.lfs_enabled == 'true' }}
23+ shell : bash
24+ run : git lfs ls-files -l | cut -d' ' -f1 | sort > .git/lfs-hashes.txt
25+
26+ - name : Restore LFS cache
27+ if : ${{ inputs.lfs_enabled == 'true' }}
28+ id : lfs-cache
29+ uses : actions/cache@v4
30+ with :
31+ path : .git/lfs
32+ key : ${{ runner.os }}-lfs-${{ hashFiles('.git/lfs-hashes.txt') }}
33+ restore-keys : |
34+ ${{ runner.os }}-lfs-
35+
36+ - name : Fetch LFS objects
37+ if : ${{ inputs.lfs_enabled == 'true' }}
38+ shell : bash
39+ run : |
40+ git lfs fetch --prune
41+ git lfs checkout
Original file line number Diff line number Diff line change @@ -36,11 +36,11 @@ jobs:
3636 image : [github_runner, github_runner_cri, cri_dev_env]
3737 steps :
3838 - uses : actions/checkout@v4
39+ - name : Handle LFS Caching
40+ uses : ./.github/actions/lfs-cache
3941 with :
42+ lfs_enabled : ' true'
4043 ref : main
41- - name : pull binaries
42- run : |
43- git lfs pull
4444 - name : docker build images
4545 run : |
46- DOCKER_BUILDKIT=1 docker build --file ./scripts/github_runner/Dockerfile.${{ matrix.image }} .
46+ DOCKER_BUILDKIT=1 docker build --file ./scripts/github_runner/Dockerfile.${{ matrix.image }} .
Original file line number Diff line number Diff line change @@ -30,11 +30,11 @@ jobs:
3030 matrix :
3131 test-name : [test, test-man-bench]
3232 steps :
33-
34- - name : Check out code into the Go module directory
35- uses : actions/checkout@v4
33+ - uses : actions/checkout@v4
34+ - name : Handle LFS Caching
35+ uses : ./.github/ actions/lfs-cache
3636 with :
37- lfs : true
37+ lfs_enabled : ' true'
3838
3939 - name : Set up Go version in go.mod file
4040 uses : actions/setup-go@v5
7878
7979 - name : Cleaning
8080 if : ${{ always() }}
81- run : ./scripts/setup_tool clean_fcctr
81+ run : ./scripts/setup_tool clean_fcctr
Original file line number Diff line number Diff line change @@ -20,10 +20,11 @@ jobs:
2020 - name : Setup TMPDIR
2121 run : mkdir -p $TMPDIR
2222
23- - name : Check out code into the Go module directory
24- uses : actions/checkout@v4
23+ - uses : actions/checkout@v4
24+ - name : Handle LFS Caching
25+ uses : ./.github/actions/lfs-cache
2526 with :
26- lfs : true
27+ lfs_enabled : ' true'
2728
2829 - name : Set up Go version in go.mod file
2930 uses : actions/setup-go@v5
@@ -109,4 +110,4 @@ jobs:
109110
110111 - name : Cleaning
111112 if : ${{ always() }}
112- run : ./scripts/github_runner/clean_cri_runner.sh
113+ run : ./scripts/github_runner/clean_cri_runner.sh
Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ jobs:
3737
3838 steps :
3939 - uses : actions/checkout@v4
40+ - name : Handle LFS Caching
41+ uses : ./.github/actions/lfs-cache
4042 with :
41- lfs : " true"
42- - name : Checkout LFS objects
43- run : git lfs checkout
43+ lfs_enabled : ' true'
4444
4545 - name : Set up Go version in go.mod file
4646 uses : actions/setup-go@v5
8282 run : kn service apply stargz-test -f ./configs/knative_workloads/stargz-node.yaml --concurrency-target 1
8383
8484 - name : Curl container
85- run : curl http://stargz-test.default.127.0.0.1.sslip.io | grep "Hello World"
85+ run : curl http://stargz-test.default.127.0.0.1.sslip.io | grep "Hello World"
Original file line number Diff line number Diff line change @@ -125,10 +125,11 @@ jobs:
125125 matrix :
126126 module : [ ctriface, ctriface/image, devmapper ]
127127 steps :
128- - name : Check out code into the Go module directory
129- uses : actions/checkout@v4
128+ - uses : actions/checkout@v4
129+ - name : Handle LFS Caching (Check out code into the Go module directory)
130+ uses : ./.github/actions/lfs-cache
130131 with :
131- lfs : true
132+ lfs_enabled : ' true'
132133
133134 - name : Set up Go version in go.mod file
134135 uses : actions/setup-go@v5
You can’t perform that action at this time.
0 commit comments