Commit 0f954f2 1 parent c3f9b80 commit 0f954f2 Copy full SHA for 0f954f2
File tree 4 files changed +70
-19
lines changed
4 files changed +70
-19
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ permissions:
18
18
jobs :
19
19
# Ensure project builds before running testing matrix
20
20
build :
21
- name : Build
21
+ name : Build and unit test
22
22
runs-on : ubuntu-latest
23
23
timeout-minutes : 5
24
24
steps :
@@ -27,12 +27,21 @@ jobs:
27
27
with :
28
28
go-version-file : ' go.mod'
29
29
cache : true
30
- - run : go mod download
30
+ - run : make fmt
31
31
- run : go build -v .
32
- - name : Run linters
33
- uses : golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
32
+ - run : make test
33
+
34
+ lint :
35
+ name : Lint
36
+ runs-on : ubuntu-latest
37
+ steps :
38
+ - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
39
+ - uses : actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
34
40
with :
35
- version : latest
41
+ go-version-file : ' go.mod'
42
+ cache : true
43
+ - run : make validate-fmt
44
+
36
45
37
46
generate :
38
47
runs-on : ubuntu-latest
80
89
with :
81
90
terraform_version : ${{ matrix.terraform }}
82
91
terraform_wrapper : false
83
- - run : go mod download
92
+ - run : make fmt
84
93
- env :
85
94
TF_ACC : " 1"
86
95
run : go test -v -cover ./internal/provider/
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ $(ENVTEST_ASSETS_DIR):
10
10
mkdir -p $(ENVTEST_ASSETS_DIR )
11
11
MOCKERY ?= $(ENVTEST_ASSETS_DIR ) /mockery
12
12
OAPI_CODEGEN ?= $(ENVTEST_ASSETS_DIR ) /oapi-codegen
13
- LINTER ?= $(ENVTEST_ASSETS_DIR ) /golangci-lint
14
13
15
14
# Run acceptance tests
16
15
.PHONY : testacc
@@ -25,16 +24,23 @@ test:
25
24
26
25
.PHONY : fmt
27
26
fmt :
28
- golines -w ./
29
27
gofmt -w ./
30
28
goimports -w ./
31
29
[ -z " $$ CIRCLECI" ] || git diff --exit-code --color=always # In CI: exit if anything changed
32
30
31
+ .PHONY : validate-fmt
32
+ validate-fmt :
33
+ @output=$$(gofmt -l ./ ) ; \
34
+ if [ -n " $$ output" ]; then \
35
+ echo " $$ output" ; \
36
+ echo " Please run 'make fmt' to format the code" ; \
37
+ exit 1; \
38
+ fi
39
+
33
40
.PHONY : dep
34
41
dep :
35
42
go mod download
36
43
go install golang.org/x/tools/cmd/goimports
37
- go install github.com/segmentio/golines@latest
38
44
go mod tidy
39
45
40
46
.PHONY : build
You can’t perform that action at this time.
0 commit comments