Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract a composite action to install Go #9

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/actions/install-go/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Setup Go"
description: "Reusable action to install Go, so there is one place to bump Go versions"
inputs:
go-version:
required: true
default: "1.20.13"
description: "Go version to install"

runs:
using: composite
steps:
- name: "Setup Go"
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}
cache: false # see actions/setup-go#368
6 changes: 2 additions & 4 deletions .github/workflows/build-test-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ jobs:
working-directory: src/github.com/containerd/containerd

steps:
- uses: actions/setup-go@v5
with:
go-version: "1.20.13"

- uses: actions/checkout@v4
with:
path: src/github.com/containerd/containerd

- uses: ./src/github.com/containerd/containerd/.github/actions/install-go

- name: Set env
shell: bash
run: |
Expand Down
51 changes: 12 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ on:
- main
- "release/**"

env:
# Go version we currently use to build containerd across all CI.
# Note: don't forget to update `Binaries` step, as it contains the matrix of all supported Go versions.
GO_VERSION: "1.20.13"

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

Expand All @@ -34,11 +29,8 @@ jobs:
os: [ubuntu-20.04, actuated-arm64-4cpu-16gb, macos-12, windows-2019]

steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/checkout@v4
- uses: ./.github/actions/install-go
- uses: golangci/golangci-lint-action@v4
with:
version: v1.51.1
Expand All @@ -55,15 +47,13 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/checkout@v4
with:
path: src/github.com/containerd/containerd
fetch-depth: 100

- uses: ./src/github.com/containerd/containerd/.github/actions/install-go

- uses: containerd/project-checks@v1.1.0
with:
working-directory: src/github.com/containerd/containerd
Expand All @@ -88,14 +78,12 @@ jobs:
working-directory: src/github.com/containerd/containerd

steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/checkout@v4
with:
path: src/github.com/containerd/containerd

- uses: ./src/github.com/containerd/containerd/.github/actions/install-go

- name: Set env
shell: bash
run: |
Expand All @@ -120,10 +108,8 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v4
- uses: ./.github/actions/install-go
- run: go install github.com/cpuguy83/go-md2man/v2@v2.0.2
- run: make man

Expand Down Expand Up @@ -153,10 +139,8 @@ jobs:
goarm: "7"

steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v4
- uses: ./.github/actions/install-go
- run: |
set -e -x

Expand Down Expand Up @@ -209,12 +193,8 @@ jobs:
os: [ubuntu-20.04, actuated-arm64-4cpu-16gb, macos-12, windows-2019, windows-2022]
go-version: ["1.20.13", "1.21.6"]
steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- uses: actions/checkout@v4

- uses: ./.github/actions/install-go
- name: Make
run: |
make build
Expand Down Expand Up @@ -243,14 +223,12 @@ jobs:
working-directory: src/github.com/containerd/containerd

steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/checkout@v4
with:
path: src/github.com/containerd/containerd

- uses: ./src/github.com/containerd/containerd/.github/actions/install-go

- uses: actions/checkout@v4
with:
repository: kubernetes-sigs/cri-tools
Expand Down Expand Up @@ -413,11 +391,8 @@ jobs:
env:
GOTEST: gotestsum --
steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/checkout@v4
- uses: ./.github/actions/install-go

- name: Install containerd dependencies
env:
Expand Down Expand Up @@ -548,10 +523,8 @@ jobs:
GOTEST: gotestsum --

steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v4
- uses: ./.github/actions/install-go
- run: script/setup/install-gotestsum
- run: script/setup/install-teststat
- name: Tests
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: 1.20.13
- uses: ./.github/actions/install-go

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/setup-go@v5
- uses: actions/checkout@v4
- uses: ./.github/actions/install-go
with:
# FIXME: go-fuzz fails with Go 1.20: `cgo_unix_cgo_res.cgo2.c:(.text+0x32): undefined reference to `__res_search'`
# https://github.com/containerd/containerd/pull/8103#issuecomment-1429256152
go-version: 1.18
- uses: actions/checkout@v4
- run: script/go-test-fuzz.sh
6 changes: 2 additions & 4 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ jobs:
working-directory: src/github.com/containerd/containerd

steps:
- uses: actions/setup-go@v5
with:
go-version: "1.20.13"

- uses: actions/checkout@v4
with:
path: src/github.com/containerd/containerd

- uses: ./src/github.com/containerd/containerd/.github/actions/install-go

- name: Set env
shell: bash
run: |
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
paths:
- ".github/workflows/nightly.yml"

env:
GO_VERSION: "1.20.13"

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

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

steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/checkout@v4
with:
path: src/github.com/containerd/containerd

- uses: ./src/github.com/containerd/containerd/.github/actions/install-go

- name: Set env
shell: bash
run: |
Expand Down Expand Up @@ -143,14 +138,12 @@ jobs:
working-directory: src/github.com/containerd/containerd

steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/checkout@v4
with:
path: src/github.com/containerd/containerd

- uses: ./src/github.com/containerd/containerd/.github/actions/install-go

- name: Set env
shell: bash
run: |
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:

name: Release

env:
GO_VERSION: "1.20.13"

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

Expand Down
Loading