From f24e293771df3756ab01b96eaaff8dc956cc6227 Mon Sep 17 00:00:00 2001 From: Ivan De Marino Date: Mon, 20 Jun 2022 11:14:43 +0100 Subject: [PATCH 1/2] Fix GH Actions and how they fetch the Golang version from `go.mod` --- .github/workflows/ci-github-actions.yml | 5 +---- .github/workflows/ci-go.yml | 22 ++-------------------- .github/workflows/ci-goreleaser.yml | 5 +---- .github/workflows/release.yml | 8 +------- 4 files changed, 5 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci-github-actions.yml b/.github/workflows/ci-github-actions.yml index ba790468..0b6e2d3e 100644 --- a/.github/workflows/ci-github-actions.yml +++ b/.github/workflows/ci-github-actions.yml @@ -14,11 +14,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - id: go-version - # Reference: https://github.com/actions/setup-go/issues/23 - run: echo "::set-output name=version::$(cat ./.go-version)" - uses: actions/setup-go@v3 with: - go-version: ${{ steps.go-version.outputs.version }} + go-version-file: 'go.mod' - run: go install github.com/rhysd/actionlint/cmd/actionlint@latest - run: actionlint diff --git a/.github/workflows/ci-go.yml b/.github/workflows/ci-go.yml index 2e539313..e8710cb4 100644 --- a/.github/workflows/ci-go.yml +++ b/.github/workflows/ci-go.yml @@ -21,26 +21,8 @@ jobs: with: go-version-file: 'go.mod' - run: go mod download - - uses: golangci/golangci-lint-action@v3.2.0 - with: - skip-go-installation: true - terraform-provider-corner: - defaults: - run: - working-directory: terraform-provider-corner - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/checkout@v3 - with: - path: terraform-provider-corner - repository: hashicorp/terraform-provider-corner - - uses: actions/setup-go@v3 - with: - go-version-file: 'go.mod' - - run: go mod edit -replace=github.com/hashicorp/terraform-plugin-framework-validators=../ - - run: go mod tidy - - run: go test -v ./internal/frameworkprovider + - uses: golangci/golangci-lint-action@v3 + test: name: test (Go v${{ matrix.go-version }}) runs-on: ubuntu-latest diff --git a/.github/workflows/ci-goreleaser.yml b/.github/workflows/ci-goreleaser.yml index 4d9e32e3..c47009a2 100644 --- a/.github/workflows/ci-goreleaser.yml +++ b/.github/workflows/ci-goreleaser.yml @@ -14,12 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - id: go-version - # Reference: https://github.com/actions/setup-go/issues/23 - run: echo "::set-output name=version::$(cat ./.go-version)" - uses: actions/setup-go@v3 with: - go-version: ${{ steps.go-version.outputs.version }} + go-version-file: 'go.mod' - uses: goreleaser/goreleaser-action@v3 with: args: check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25cf93e7..3625cf41 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,15 +16,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - # Required for release notes - fetch-depth: 0 - - id: go-version - # Reference: https://github.com/actions/setup-go/issues/23 - run: echo "::set-output name=version::$(cat ./.go-version)" - uses: actions/setup-go@v3 with: - go-version: ${{ steps.go-version.outputs.version }} + go-version-file: 'go.mod' - name: Generate Release Notes # Fetch CHANGELOG.md contents up to Git tag prior to this release, skipping top two lines run: sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > /tmp/release-notes.txt From c1fc87881db4f819943c9a4f32d2870f47862109 Mon Sep 17 00:00:00 2001 From: Ivan De Marino Date: Mon, 20 Jun 2022 11:15:07 +0100 Subject: [PATCH 2/2] Add a simple `Makefile` to help with basic tasks --- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..cf2a4c96 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +default: build + +build: + go build -v ./... + +lint: + golangci-lint run + +fmt: + gofmt -s -w -e . + +test: + go test -v -cover -timeout=120s -parallel=4 ./... + +.PHONY: build lint fmt test