From e988bc776b16ade616fc2a6cf28643d30bbc0812 Mon Sep 17 00:00:00 2001 From: David May <1301201+wass3r@users.noreply.github.com> Date: Thu, 18 Aug 2022 14:11:50 -0500 Subject: [PATCH] chore(actions): fix actions (#76) * chore(actions): fix actions * fix(ci): make go install consistent across steps --- .github/workflows/build.yml | 10 ++++++++-- .github/workflows/prerelease.yml | 10 ++++++++-- .github/workflows/publish.yml | 10 ++++++++-- .github/workflows/reviewdog.yml | 20 ++++++++++++++++---- .github/workflows/test.yml | 10 ++++++++-- .github/workflows/validate.yml | 10 ++++++++-- 6 files changed, 56 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e769fc..75a74bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,12 +10,18 @@ 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@v3 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + - name: build run: | make build diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index f56a924..8ef3cec 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,13 @@ jobs: # ensures we fetch tag history for the repository fetch-depth: 0 + - name: install go + uses: actions/setup-go@v3 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + - name: setup run: | # setup git tag in Actions environment diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2300594..a14d5ed 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,13 @@ jobs: # ensures we fetch tag history for the repository fetch-depth: 0 + - name: install go + uses: actions/setup-go@v3 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + - name: build env: GOOS: linux diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index d580eb2..5aaa384 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -9,12 +9,18 @@ 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@v3 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + - name: golangci-lint uses: reviewdog/action-golangci-lint@v2 with: @@ -26,12 +32,18 @@ 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@v3 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: 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..62ff7f3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,12 +10,18 @@ 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@v3 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: 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..45aed83 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -10,12 +10,18 @@ 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@v3 + with: + # use version from go.mod file + go-version-file: 'go.mod' + cache: true + - name: validate run: | # Check that go mod tidy produces a zero diff; clean up any changes afterwards.