Skip to content

Commit

Permalink
add scaffolding for go bump to 1.22
Browse files Browse the repository at this point in the history
- Add "make go-version" in Makefile to easily access used Go version
- Add setup-go steps to functional and build workflows that setup the
  correct version of Go
- Bump gomod prow test to 1.22 (pairs with PR in project-infra)

This should allow the actual bump to golang 1.22 to succeed.

Signed-off-by: Tuomo Tanskanen <tuomo.tanskanen@est.tech>
  • Loading branch information
tuminoid committed Jun 10, 2024
1 parent 938d10e commit ca4d9c9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ name: Building and testing

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Calculate go version
id: vars
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.vars.outputs.go_version }}
- name: Run unit tests
run: make test
container:
Expand All @@ -25,6 +32,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Calculate go version
id: vars
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.vars.outputs.go_version }}
- name: Generate manifests
run: make generate manifests
- name: Ensure there is no diff
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/functional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ name: Functional

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
functional:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Calculate go version
id: vars
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.vars.outputs.go_version }}
- uses: helm/kind-action@v1
with:
cluster_name: kind
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,7 @@ catalog-build: opm ## Build a catalog image.
.PHONY: catalog-push
catalog-push: ## Push a catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)

##@ helpers:
go-version: ## Print the go version we use to compile our binaries and images
@echo $(GO_VERSION)
2 changes: 1 addition & 1 deletion hack/gomod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ else
--volume "${PWD}:/workdir:ro,z" \
--entrypoint sh \
--workdir /workdir \
docker.io/golang:1.21 \
docker.io/golang:1.22 \
/workdir/hack/gomod.sh "$@"
fi

0 comments on commit ca4d9c9

Please sign in to comment.