From 063f8db2c7f640a13c3255a0d7c6575cec3666a4 Mon Sep 17 00:00:00 2001 From: Brendan Winter Date: Fri, 2 Jun 2023 12:48:22 -0700 Subject: [PATCH] Cleanup release workflow actions. - Fix golint version - Use the new linter and checkout actions now configured in the linter job. - v3 of golint removed the go-setup dependency: https://github.com/golangci/golangci-lint-action/pull/403 Signed-off-by: Brendan Winter --- .github/workflows/release.yml | 56 +++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 81f587a..35a966c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,39 +2,57 @@ name: Release on: push: - tags: - - 'v*' + tags: [ v* ] + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + # Permission for checking out code + contents: read + jobs: + unit: + name: Unit Tests + runs-on: ubuntu-latest + strategy: + matrix: + go: ["1.18.x", "1.19.x", "1.20.x"] + steps: + - uses: actions/checkout@v3 + - run: go test -timeout=120s -v -race -short + goreleaser: runs-on: ubuntu-latest steps: - - - name: Checkout - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v2 + - name: Set up Go + uses: actions/setup-go@v4 with: - go-version: 1.17 - - - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + go-version: 1.18 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 with: - version: v1.52.2 - skip-pkg-cache: true - skip-build-cache: true + # Required: the version of golangci-lint is required and must be specified without a patch version: + # we always use the latest patch version. + version: v1.52 + # Optional: if set to `true` then the all caching functionality will be complete disabled, + # takes precedence over all other caching options. + skip-cache: true args: --issues-exit-code=1 - - - name: Import GPG key + - name: Run gofmt + run: diff -u <(echo -n) <(gofmt -d .) + - name: Run go vet + run: go vet ./ + - name: Import GPG key id: import_gpg uses: crazy-max/ghaction-import-gpg@v2 env: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - - - name: Run GoReleaser + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: version: latest