From bf9e5dc1f5836a3a1893d2663461fd2a3fcecaf4 Mon Sep 17 00:00:00 2001 From: Blaine Gardner Date: Wed, 4 Oct 2023 13:41:56 -0600 Subject: [PATCH] ci: make use of caching in actions/setup-go The GH action to set up Golang (actions/setup-go) has cache functionality. For cache hits, this saves ~2 minutes for each run. In order for the cache to hit, caching must not be disabled, and the code must be checked out before setting up Golang. Signed-off-by: Blaine Gardner --- .github/workflows/codegen.yml | 8 ++++---- .github/workflows/crds-gen.yml | 8 ++++---- .github/workflows/golangci-lint.yaml | 7 +++---- .github/workflows/multus.yaml | 10 +++++----- .github/workflows/rbac-gen.yaml | 8 ++++---- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index 08106678c..2f67575cc 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -29,15 +29,15 @@ jobs: runs-on: ubuntu-20.04 if: "!contains(github.event.pull_request.labels.*.name, 'skip-ci')" steps: - - uses: actions/setup-go@v4 - with: - go-version: "1.21" - - name: checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - uses: actions/setup-go@v4 + with: + go-version: "1.21" + - name: run codegen run: GOPATH=$(go env GOPATH) make codegen diff --git a/.github/workflows/crds-gen.yml b/.github/workflows/crds-gen.yml index 7d2d7a317..5d5574d2b 100644 --- a/.github/workflows/crds-gen.yml +++ b/.github/workflows/crds-gen.yml @@ -28,15 +28,15 @@ jobs: crds-gen: runs-on: ubuntu-20.04 steps: - - uses: actions/setup-go@v4 - with: - go-version: "1.21" - - name: checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - uses: actions/setup-go@v4 + with: + go-version: "1.21" + - name: run crds-gen run: GOPATH=$(go env GOPATH) make crds diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml index 81392f53a..45943f80a 100644 --- a/.github/workflows/golangci-lint.yaml +++ b/.github/workflows/golangci-lint.yaml @@ -24,13 +24,12 @@ jobs: name: golangci-lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v4 - with: - go-version: "1.21" - cache: false - uses: actions/checkout@v4 with: fetch-depth: 0 + - uses: actions/setup-go@v4 + with: + go-version: "1.21" - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: diff --git a/.github/workflows/multus.yaml b/.github/workflows/multus.yaml index d44920e1d..763d7f022 100644 --- a/.github/workflows/multus.yaml +++ b/.github/workflows/multus.yaml @@ -31,16 +31,16 @@ jobs: env: NUMBER_OF_COMPUTE_NODES: 5 steps: - - name: Set up Go version - uses: actions/setup-go@v4 - with: - go-version: "1.21" - - name: checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Set up Go version + uses: actions/setup-go@v4 + with: + go-version: "1.21" + - name: Create KinD Cluster uses: helm/kind-action@v1.8.0 with: diff --git a/.github/workflows/rbac-gen.yaml b/.github/workflows/rbac-gen.yaml index 47c4ad7ca..44bd8a593 100644 --- a/.github/workflows/rbac-gen.yaml +++ b/.github/workflows/rbac-gen.yaml @@ -28,15 +28,15 @@ jobs: gen-rbac: runs-on: ubuntu-20.04 steps: - - uses: actions/setup-go@v4 - with: - go-version: "1.21" - - name: checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - uses: actions/setup-go@v4 + with: + go-version: "1.21" + - name: run gen-rbac run: GOPATH=$(go env GOPATH) make gen-rbac