From 3f2aee4225f6f1671ef78cbf48acbf634e6f0378 Mon Sep 17 00:00:00 2001 From: David May <49894298+wass3rw3rk@users.noreply.github.com> Date: Thu, 8 Jun 2023 15:27:35 -0500 Subject: [PATCH] chore(ci/go): update ci to use core repos pattern (#170) --- .github/workflows/build.yml | 11 +++++++++-- .github/workflows/prerelease.yml | 13 ++++++++++--- .github/workflows/publish.yml | 13 ++++++++++--- .github/workflows/reviewdog.yml | 22 ++++++++++++++++++---- .github/workflows/test.yml | 11 +++++++++-- .github/workflows/validate.yml | 11 +++++++++-- go.mod | 2 +- 7 files changed, 66 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e769fc..bdbb9a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,12 +10,19 @@ on: jobs: build: runs-on: ubuntu-latest - container: - image: golang:1.18 + steps: - name: clone uses: actions/checkout@v3 + - name: install go + uses: actions/setup-go@v4 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + check-latest: true + - name: build run: | make build diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 5fa08c6..dce8061 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -11,8 +11,7 @@ on: jobs: prerelease: runs-on: ubuntu-latest - container: - image: golang:1.18 + steps: - name: clone uses: actions/checkout@v3 @@ -20,6 +19,14 @@ jobs: # ensures we fetch tag history for the repository fetch-depth: 0 + - name: install go + uses: actions/setup-go@v4 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + check-latest: true + - name: setup run: | # setup git tag in Actions environment @@ -33,7 +40,7 @@ jobs: make build-static-ci - name: publish - uses: elgohr/Publish-Docker-Github-Action@master + uses: elgohr/Publish-Docker-Github-Action@v5 with: name: target/vela-kaniko cache: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f8133f0..48f4299 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,8 +10,7 @@ on: jobs: publish: runs-on: ubuntu-latest - container: - image: golang:1.18 + steps: - name: clone uses: actions/checkout@v3 @@ -19,6 +18,14 @@ jobs: # ensures we fetch tag history for the repository fetch-depth: 0 + - name: install go + uses: actions/setup-go@v4 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + check-latest: true + - name: build env: GOOS: linux @@ -27,7 +34,7 @@ jobs: make build-static-ci - name: publish - uses: elgohr/Publish-Docker-Github-Action@master + uses: elgohr/Publish-Docker-Github-Action@v5 with: name: target/vela-kaniko cache: true diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index d580eb2..0a0027c 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -9,12 +9,19 @@ on: jobs: diff-review: runs-on: ubuntu-latest - container: - image: golang:1.18 + steps: - name: clone uses: actions/checkout@v3 + - name: install go + uses: actions/setup-go@v4 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + check-latest: true + - name: golangci-lint uses: reviewdog/action-golangci-lint@v2 with: @@ -26,12 +33,19 @@ jobs: full-review: runs-on: ubuntu-latest - container: - image: golang:1.18 + steps: - name: clone uses: actions/checkout@v3 + - name: install go + uses: actions/setup-go@v4 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + check-latest: true + - name: golangci-lint uses: reviewdog/action-golangci-lint@v2 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b9cc040..f3cf034 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,12 +10,19 @@ on: jobs: test: runs-on: ubuntu-latest - container: - image: golang:1.18 + steps: - name: clone uses: actions/checkout@v3 + - name: install go + uses: actions/setup-go@v4 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + check-latest: true + - name: test run: | go test -race -covermode=atomic -coverprofile=coverage.out ./... diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 79e58f3..aaa32bf 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -10,12 +10,19 @@ on: jobs: validate: runs-on: ubuntu-latest - container: - image: golang:1.18 + steps: - name: clone uses: actions/checkout@v3 + - name: install go + uses: actions/setup-go@v4 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + check-latest: true + - name: validate run: | # Check that go mod tidy produces a zero diff; clean up any changes afterwards. diff --git a/go.mod b/go.mod index 33b627e..957688b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/go-vela/vela-kaniko -go 1.18 +go 1.20 require ( github.com/Masterminds/semver/v3 v3.2.1