Skip to content

Commit b3f1c15

Browse files
authored
Merge pull request containerd#9786 from mxpv/ci
Extract setup-go step into composite action
2 parents b466b7e + 360fbf1 commit b3f1c15

File tree

7 files changed

+38
-73
lines changed

7 files changed

+38
-73
lines changed

.github/actions/install-go/action.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "Setup Go"
2+
description: "Reusable action to install Go, so there is one place to bump Go versions"
3+
inputs:
4+
go-version:
5+
required: true
6+
default: "1.21.6"
7+
description: "Go version to install"
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: "Setup Go"
13+
uses: actions/setup-go@v5
14+
with:
15+
go-version: ${{ inputs.go-version }}
16+
cache: false # see actions/setup-go#368

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,12 @@ jobs:
4141
working-directory: src/github.com/containerd/containerd
4242

4343
steps:
44-
- uses: actions/setup-go@v5
45-
with:
46-
go-version: "1.21.6"
47-
4844
- uses: actions/checkout@v4
4945
with:
5046
path: src/github.com/containerd/containerd
5147

48+
- uses: ./src/github.com/containerd/containerd/.github/actions/install-go
49+
5250
- name: Set env
5351
shell: bash
5452
run: |

.github/workflows/ci.yml

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ on:
66
pull_request:
77
branches: ['main', 'release/**']
88

9-
env:
10-
# Go version we currently use to build containerd across all CI.
11-
# Note: don't forget to update `Binaries` step, as it contains the matrix of all supported Go versions.
12-
GO_VERSION: "1.21.6"
13-
149
permissions: # added using https://github.com/step-security/secure-workflows
1510
contents: read
1611

@@ -31,12 +26,8 @@ jobs:
3126
os: [ubuntu-22.04, actuated-arm64-4cpu-16gb, macos-12, windows-2019]
3227

3328
steps:
34-
- uses: actions/setup-go@v5
35-
with:
36-
go-version: ${{ env.GO_VERSION }}
37-
cache: false # see actions/setup-go#368
38-
3929
- uses: actions/checkout@v4
30+
- uses: ./.github/actions/install-go
4031
- uses: golangci/golangci-lint-action@v3
4132
with:
4233
version: v1.55.2
@@ -53,16 +44,13 @@ jobs:
5344
timeout-minutes: 5
5445

5546
steps:
56-
- uses: actions/setup-go@v5
57-
with:
58-
go-version: ${{ env.GO_VERSION }}
59-
cache: false # see actions/setup-go#368
60-
6147
- uses: actions/checkout@v4
6248
with:
6349
path: src/github.com/containerd/containerd
6450
fetch-depth: 100
6551

52+
- uses: ./src/github.com/containerd/containerd/.github/actions/install-go
53+
6654
- uses: containerd/[email protected]
6755
with:
6856
working-directory: src/github.com/containerd/containerd
@@ -87,15 +75,12 @@ jobs:
8775
working-directory: src/github.com/containerd/containerd
8876

8977
steps:
90-
- uses: actions/setup-go@v5
91-
with:
92-
go-version: ${{ env.GO_VERSION }}
93-
cache: false # see actions/setup-go#368
94-
9578
- uses: actions/checkout@v4
9679
with:
9780
path: src/github.com/containerd/containerd
9881

82+
- uses: ./src/github.com/containerd/containerd/.github/actions/install-go
83+
9984
- name: Set env
10085
shell: bash
10186
run: |
@@ -120,11 +105,8 @@ jobs:
120105
timeout-minutes: 5
121106

122107
steps:
123-
- uses: actions/setup-go@v5
124-
with:
125-
go-version: ${{ env.GO_VERSION }}
126-
cache: false # see actions/setup-go#368
127108
- uses: actions/checkout@v4
109+
- uses: ./.github/actions/install-go
128110
- run: go install github.com/cpuguy83/go-md2man/[email protected]
129111
- run: make man
130112

@@ -154,11 +136,8 @@ jobs:
154136
goarm: "7"
155137

156138
steps:
157-
- uses: actions/setup-go@v5
158-
with:
159-
go-version: ${{ env.GO_VERSION }}
160-
cache: false # see actions/setup-go#368
161139
- uses: actions/checkout@v4
140+
- uses: ./.github/actions/install-go
162141
- run: |
163142
set -e -x
164143
@@ -211,13 +190,8 @@ jobs:
211190
os: [ubuntu-22.04, actuated-arm64-4cpu-16gb, macos-12, windows-2019, windows-2022]
212191
go-version: ["1.20.13", "1.21.6"]
213192
steps:
214-
- uses: actions/setup-go@v5
215-
with:
216-
go-version: ${{ matrix.go-version }}
217-
cache: false # see actions/setup-go#368
218-
219193
- uses: actions/checkout@v4
220-
194+
- uses: ./.github/actions/install-go
221195
- name: Make
222196
run: |
223197
make build
@@ -245,15 +219,12 @@ jobs:
245219
working-directory: src/github.com/containerd/containerd
246220

247221
steps:
248-
- uses: actions/setup-go@v5
249-
with:
250-
go-version: ${{ env.GO_VERSION }}
251-
cache: false # see actions/setup-go#368
252-
253222
- uses: actions/checkout@v4
254223
with:
255224
path: src/github.com/containerd/containerd
256225

226+
- uses: ./src/github.com/containerd/containerd/.github/actions/install-go
227+
257228
- uses: actions/checkout@v4
258229
with:
259230
repository: kubernetes-sigs/cri-tools
@@ -409,12 +380,8 @@ jobs:
409380
env:
410381
GOTEST: gotestsum --
411382
steps:
412-
- uses: actions/setup-go@v5
413-
with:
414-
go-version: ${{ env.GO_VERSION }}
415-
cache: false # see actions/setup-go#368
416-
417383
- uses: actions/checkout@v4
384+
- uses: ./.github/actions/install-go
418385

419386
- name: Install containerd dependencies
420387
env:
@@ -614,11 +581,8 @@ jobs:
614581
GOTEST: gotestsum --
615582

616583
steps:
617-
- uses: actions/setup-go@v5
618-
with:
619-
go-version: ${{ env.GO_VERSION }}
620-
cache: false # see actions/setup-go#368
621584
- uses: actions/checkout@v4
585+
- uses: ./.github/actions/install-go
622586
- run: script/setup/install-gotestsum
623587
- run: script/setup/install-teststat
624588
- name: Tests

.github/workflows/codeql.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ jobs:
3232
- name: Checkout repository
3333
uses: actions/checkout@v4
3434

35-
- uses: actions/setup-go@v5
36-
with:
37-
go-version: 1.21.6
35+
- uses: ./.github/actions/install-go
3836

3937
# Initializes the CodeQL tools for scanning.
4038
- name: Initialize CodeQL

.github/workflows/fuzz.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ jobs:
4040
runs-on: ubuntu-latest
4141
timeout-minutes: 30
4242
steps:
43-
- uses: actions/setup-go@v5
44-
with:
45-
go-version: 1.21.x
4643
- uses: actions/checkout@v4
44+
- uses: ./.github/actions/install-go
4745
- run: script/go-test-fuzz.sh

.github/workflows/images.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ jobs:
2626
working-directory: src/github.com/containerd/containerd
2727

2828
steps:
29-
- uses: actions/setup-go@v5
30-
with:
31-
go-version: "1.21.6"
32-
3329
- uses: actions/checkout@v4
3430
with:
3531
path: src/github.com/containerd/containerd
3632

33+
- uses: ./src/github.com/containerd/containerd/.github/actions/install-go
34+
3735
- name: Set env
3836
shell: bash
3937
run: |

.github/workflows/nightly.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
paths:
77
- ".github/workflows/nightly.yml"
88

9-
env:
10-
GO_VERSION: "1.21.6"
11-
129
permissions: # added using https://github.com/step-security/secure-workflows
1310
contents: read
1411

@@ -23,14 +20,12 @@ jobs:
2320
working-directory: src/github.com/containerd/containerd
2421

2522
steps:
26-
- uses: actions/setup-go@v5
27-
with:
28-
go-version: ${{ env.GO_VERSION }}
29-
3023
- uses: actions/checkout@v4
3124
with:
3225
path: src/github.com/containerd/containerd
3326

27+
- uses: ./src/github.com/containerd/containerd/.github/actions/install-go
28+
3429
- name: Set env
3530
shell: bash
3631
run: |
@@ -143,14 +138,12 @@ jobs:
143138
working-directory: src/github.com/containerd/containerd
144139

145140
steps:
146-
- uses: actions/setup-go@v5
147-
with:
148-
go-version: ${{ env.GO_VERSION }}
149-
150141
- uses: actions/checkout@v4
151142
with:
152143
path: src/github.com/containerd/containerd
153144

145+
- uses: ./src/github.com/containerd/containerd/.github/actions/install-go
146+
154147
- name: Set env
155148
shell: bash
156149
run: |

0 commit comments

Comments
 (0)