Skip to content

Commit 25b6855

Browse files
authored
[ci] Enable caching for proto and integration jobs (#1755)
Caching is enabled by default in `actions/setup-go@v4` (https://githut b.com/actions/setup-go#caching-dependency-files-and-build-outputs) so update the `go.sum` path when checking out hcsshim to a non-default path. Additionally, disable for linting, since that often causes errors. Without caching, wont need to explicitly delete the module cache. Relies on: #1752 Signed-off-by: Hamza El-Saawy <[email protected]>
1 parent 8d4a20c commit 25b6855

1 file changed

Lines changed: 48 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ env:
88
GOTESTSUM_VERSION: "latest"
99

1010
jobs:
11+
1112
lint:
1213
runs-on: "windows-2022"
1314
strategy:
@@ -25,15 +26,18 @@ jobs:
2526
./internal/tools/...
2627
./pkg/...
2728
./ext4/...
29+
2830
steps:
29-
- uses: actions/checkout@v3
30-
- uses: actions/setup-go@v4
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
34+
- name: Install go
35+
uses: actions/setup-go@v4
3136
with:
3237
go-version: ${{ env.GO_VERSION }}
33-
- name: Clean mod cache
34-
shell: Powershell
35-
run: |
36-
go clean -modcache
38+
# sometimes go cache causes issues with lint
39+
cache: false
40+
3741
- uses: golangci/golangci-lint-action@v3
3842
with:
3943
version: v1.52
@@ -42,6 +46,7 @@ jobs:
4246
--max-issues-per-linter=0
4347
--max-same-issues=0
4448
--modules-download-mode=readonly
49+
--timeout=10m
4550
${{ matrix.dirs }}
4651
working-directory: ${{ matrix.root }}
4752
env:
@@ -55,14 +60,16 @@ jobs:
5560
GOPATH: '${{ github.workspace }}\go'
5661

5762
steps:
58-
- uses: actions/setup-go@v4
63+
- name: Checkout hcsshim
64+
uses: actions/checkout@v3
5965
with:
60-
go-version: ${{ env.GO_VERSION }}
66+
path: go/src/github.com/Microsoft/hcsshim
6167

62-
- uses: actions/checkout@v3
68+
- name: Install go
69+
uses: actions/setup-go@v4
6370
with:
64-
path: "go/src/github.com/Microsoft/hcsshim"
65-
name: Checkout hcsshim
71+
go-version: ${{ env.GO_VERSION }}
72+
cache-dependency-path: go/src/github.com/Microsoft/hcsshim/go.sum
6673

6774
- name: Get containerd ref
6875
shell: powershell
@@ -77,12 +84,12 @@ jobs:
7784
"containerd_ref=$v" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
7885
working-directory: go/src/github.com/Microsoft/hcsshim
7986

80-
- uses: actions/checkout@v3
87+
- name: Checkout containerd
88+
uses: actions/checkout@v3
8189
with:
8290
repository: containerd/containerd
8391
path: "containerd"
8492
ref: "${{ env.containerd_ref }}"
85-
name: Checkout containerd
8693

8794
- name: Install protobuild and protoc-gen-gogoctrd
8895
shell: powershell
@@ -143,9 +150,11 @@ jobs:
143150
env:
144151
GOPROXY: "https://proxy.golang.org,direct"
145152
steps:
146-
- uses: actions/checkout@v3
153+
- name: Checkout
154+
uses: actions/checkout@v3
147155

148-
- uses: actions/setup-go@v4
156+
- name: Install go
157+
uses: actions/setup-go@v4
149158
with:
150159
go-version: ${{ env.GO_VERSION }}
151160

@@ -181,10 +190,14 @@ jobs:
181190
name: Go Generate
182191
runs-on: "windows-2022"
183192
steps:
184-
- uses: actions/checkout@v3
185-
- uses: actions/setup-go@v4
193+
- name: Checkout
194+
uses: actions/checkout@v3
195+
196+
- name: Install go
197+
uses: actions/setup-go@v4
186198
with:
187199
go-version: ${{ env.GO_VERSION }}
200+
188201
- name: Validate go generate
189202
shell: powershell
190203
run: |
@@ -243,8 +256,11 @@ jobs:
243256
matrix:
244257
os: [windows-2019, windows-2022]
245258
steps:
246-
- uses: actions/checkout@v3
247-
- uses: actions/setup-go@v4
259+
- name: Checkout
260+
uses: actions/checkout@v3
261+
262+
- name: Install go
263+
uses: actions/setup-go@v4
248264
with:
249265
go-version: ${{ env.GO_VERSION }}
250266

@@ -304,10 +320,17 @@ jobs:
304320
os: [windows-2019, windows-2022]
305321

306322
steps:
307-
- uses: actions/setup-go@v4
323+
- name: Checkout hcsshim
324+
uses: actions/checkout@v3
325+
with:
326+
path: src/github.com/Microsoft/hcsshim
327+
328+
- name: Install go
329+
uses: actions/setup-go@v4
308330
with:
309331
go-version: ${{ env.GO_VERSION }}
310332
check-latest: true
333+
cache-dependency-path: src/github.com/Microsoft/hcsshim/go.sum
311334

312335
- name: Set env
313336
shell: bash
@@ -317,11 +340,6 @@ jobs:
317340
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
318341
echo "${{ github.workspace }}/src/github.com/containerd/containerd/bin" >> $GITHUB_PATH
319342
320-
- uses: actions/checkout@v3
321-
with:
322-
path: src/github.com/Microsoft/hcsshim
323-
name: Checkout hcsshim
324-
325343
- name: Get containerd ref
326344
shell: powershell
327345
run: |
@@ -500,8 +518,11 @@ jobs:
500518
needs: [test-windows, test-linux]
501519
runs-on: "windows-2022"
502520
steps:
503-
- uses: actions/checkout@v3
504-
- uses: actions/setup-go@v4
521+
- name: Checkout
522+
uses: actions/checkout@v3
523+
524+
- name: Install go
525+
uses: actions/setup-go@v4
505526
with:
506527
go-version: ${{ env.GO_VERSION }}
507528

0 commit comments

Comments
 (0)