Skip to content

Commit f80bdba

Browse files
author
Ivan De Marino
authored
Fix GH Actions + basic Makefile (#35)
* Fix GH Actions and how they fetch the Golang version from `go.mod` * Add a simple `Makefile` to help with basic tasks
1 parent 1735818 commit f80bdba

File tree

5 files changed

+20
-35
lines changed

5 files changed

+20
-35
lines changed

.github/workflows/ci-github-actions.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v3
17-
- id: go-version
18-
# Reference: https://github.com/actions/setup-go/issues/23
19-
run: echo "::set-output name=version::$(cat ./.go-version)"
2017
- uses: actions/setup-go@v3
2118
with:
22-
go-version: ${{ steps.go-version.outputs.version }}
19+
go-version-file: 'go.mod'
2320
- run: go install github.com/rhysd/actionlint/cmd/actionlint@latest
2421
- run: actionlint

.github/workflows/ci-go.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,8 @@ jobs:
2121
with:
2222
go-version-file: 'go.mod'
2323
- run: go mod download
24-
- uses: golangci/[email protected]
25-
with:
26-
skip-go-installation: true
27-
terraform-provider-corner:
28-
defaults:
29-
run:
30-
working-directory: terraform-provider-corner
31-
runs-on: ubuntu-latest
32-
steps:
33-
- uses: actions/checkout@v3
34-
- uses: actions/checkout@v3
35-
with:
36-
path: terraform-provider-corner
37-
repository: hashicorp/terraform-provider-corner
38-
- uses: actions/setup-go@v3
39-
with:
40-
go-version-file: 'go.mod'
41-
- run: go mod edit -replace=github.com/hashicorp/terraform-plugin-framework-validators=../
42-
- run: go mod tidy
43-
- run: go test -v ./internal/frameworkprovider
24+
- uses: golangci/golangci-lint-action@v3
25+
4426
test:
4527
name: test (Go v${{ matrix.go-version }})
4628
runs-on: ubuntu-latest

.github/workflows/ci-goreleaser.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v3
17-
- id: go-version
18-
# Reference: https://github.com/actions/setup-go/issues/23
19-
run: echo "::set-output name=version::$(cat ./.go-version)"
2017
- uses: actions/setup-go@v3
2118
with:
22-
go-version: ${{ steps.go-version.outputs.version }}
19+
go-version-file: 'go.mod'
2320
- uses: goreleaser/goreleaser-action@v3
2421
with:
2522
args: check

.github/workflows/release.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,9 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v3
19-
with:
20-
# Required for release notes
21-
fetch-depth: 0
22-
- id: go-version
23-
# Reference: https://github.com/actions/setup-go/issues/23
24-
run: echo "::set-output name=version::$(cat ./.go-version)"
2519
- uses: actions/setup-go@v3
2620
with:
27-
go-version: ${{ steps.go-version.outputs.version }}
21+
go-version-file: 'go.mod'
2822
- name: Generate Release Notes
2923
# Fetch CHANGELOG.md contents up to Git tag prior to this release, skipping top two lines
3024
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

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
default: build
2+
3+
build:
4+
go build -v ./...
5+
6+
lint:
7+
golangci-lint run
8+
9+
fmt:
10+
gofmt -s -w -e .
11+
12+
test:
13+
go test -v -cover -timeout=120s -parallel=4 ./...
14+
15+
.PHONY: build lint fmt test

0 commit comments

Comments
 (0)