1
1
SHELL =/bin/bash -o pipefail
2
2
3
- export GO111MODULE := on
4
- export PATH := .bin:${PATH}
5
- export PWD := $(shell pwd)
6
- export IMAGE_TAG := $(if $(IMAGE_TAG ) ,$(IMAGE_TAG ) ,latest)
3
+ export PATH := .bin:${PATH}
4
+ export PWD := $(shell pwd)
5
+ export IMAGE_TAG := $(if $(IMAGE_TAG ) ,$(IMAGE_TAG ) ,latest)
7
6
8
7
GOLANGCI_LINT_VERSION = 1.64.8
9
8
10
- GO_DEPENDENCIES = github.com/ory/go-acc \
11
- github.com/golang/mock/mockgen \
12
- golang.org/x/tools/cmd/goimports \
13
- github.com/go-swagger/go-swagger/cmd/swagger
14
-
15
- define make-go-dependency
16
- # go install is responsible for not re-building when the code hasn't changed
17
- .bin/$(notdir $1) : go.sum go.mod
18
- GOBIN=$(PWD ) /.bin/ go install $1
19
- endef
20
-
21
- .bin/golangci-lint-$(GOLANGCI_LINT_VERSION ) :
9
+ .bin/golangci-lint : Makefile
22
10
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b .bin v$(GOLANGCI_LINT_VERSION )
23
- mv .bin/golangci-lint .bin/golangci-lint-$(GOLANGCI_LINT_VERSION )
24
11
25
12
$(foreach dep, $(GO_DEPENDENCIES), $(eval $(call make-go-dependency, $(dep))))
26
13
27
14
node_modules : package-lock.json
28
15
npm ci
29
16
touch node_modules
30
17
31
- .PHONY : .bin/yq
32
- .bin/yq :
33
- go build -o .bin/yq github.com/mikefarah/yq/v4
34
-
35
18
.bin/clidoc : go.mod
36
19
go build -o .bin/clidoc ./cmd/clidoc/.
37
20
@@ -46,14 +29,14 @@ docs/cli: .bin/clidoc
46
29
touch .bin/ory
47
30
48
31
.PHONY : lint
49
- lint : .bin/golangci-lint- $( GOLANGCI_LINT_VERSION )
50
- .bin/ golangci-lint- $( GOLANGCI_LINT_VERSION ) run -v ./...
32
+ lint : .bin/golangci-lint
33
+ golangci-lint run -v ./...
51
34
52
35
# Runs full test suite including tests where databases are enabled
53
36
.PHONY : test
54
- test : .bin/go-acc
37
+ test :
55
38
make test-resetdb
56
- source scripts/test-env.sh && go-acc ./... -- - failfast -timeout=20m -tags sqlite,sqlite_omit_load_extension
39
+ source scripts/test-env.sh && go test - failfast -timeout=20m -tags sqlite,sqlite_omit_load_extension ./...
57
40
docker rm -f hydra_test_database_mysql
58
41
docker rm -f hydra_test_database_postgres
59
42
docker rm -f hydra_test_database_cockroach
@@ -101,22 +84,22 @@ authors: # updates the AUTHORS file
101
84
102
85
# Formats the code
103
86
.PHONY : format
104
- format : .bin/goimports .bin/ ory node_modules
105
- .bin/ ory dev headers copyright --type=open-source --exclude=internal/httpclient
106
- .bin/ goimports -w --local github.com/ory .
87
+ format : .bin/ory node_modules
88
+ ory dev headers copyright --type=open-source --exclude=internal/httpclient
89
+ go tool goimports -w --local github.com/ory .
107
90
npm exec -- prettier --write .
108
91
109
92
# Generates mocks
110
93
.PHONY : mocks
111
- mocks : .bin/mockgen
112
- mockgen -package oauth2_test -destination oauth2/oauth2_provider_mock_test.go github.com/ory/fosite OAuth2Provider
113
- mockgen -package jwk_test -destination jwk/registry_mock_test.go -source=jwk/registry.go
94
+ mocks :
95
+ go tool mockgen -package oauth2_test -destination oauth2/oauth2_provider_mock_test.go github.com/ory/fosite OAuth2Provider
96
+ go tool mockgen -package jwk_test -destination jwk/registry_mock_test.go -source=jwk/registry.go
114
97
go generate ./...
115
98
116
99
# Generates the SDKs
117
100
.PHONY : sdk
118
- sdk : .bin/swagger .bin/ ory node_modules
119
- swagger generate spec -m -o spec/swagger.json \
101
+ sdk : .bin/ory node_modules
102
+ go tool swagger generate spec -m -o spec/swagger.json \
120
103
-c github.com/ory/hydra/v2/client \
121
104
-c github.com/ory/hydra/v2/consent \
122
105
-c github.com/ory/hydra/v2/flow \
@@ -129,7 +112,7 @@ sdk: .bin/swagger .bin/ory node_modules
129
112
-c github.com/ory/x/pagination \
130
113
-c github.com/ory/herodot
131
114
ory dev swagger sanitize ./spec/swagger.json
132
- swagger validate ./spec/swagger.json
115
+ go tool swagger validate ./spec/swagger.json
133
116
CIRCLE_PROJECT_USERNAME=ory CIRCLE_PROJECT_REPONAME=hydra \
134
117
ory dev openapi migrate \
135
118
--health-path-tags metadata \
@@ -191,13 +174,10 @@ install:
191
174
go install -tags sqlite,sqlite_omit_load_extension .
192
175
193
176
.PHONY : post-release
194
- post-release : .bin/yq
195
- yq e ' .services.hydra.image = "oryd/hydra:' $$ DOCKER_TAG' "' -i quickstart.yml
196
- yq e ' .services.hydra-migrate.image = "oryd/hydra:' $$ DOCKER_TAG' "' -i quickstart.yml
197
- yq e ' .services.consent.image = "oryd/hydra-login-consent-node:' $$ DOCKER_TAG' "' -i quickstart.yml
198
-
199
- generate : .bin/mockgen
200
- go generate ./...
177
+ post-release :
178
+ go tool yq e ' .services.hydra.image = "oryd/hydra:' $$ DOCKER_TAG' "' -i quickstart.yml
179
+ go tool yq e ' .services.hydra-migrate.image = "oryd/hydra:' $$ DOCKER_TAG' "' -i quickstart.yml
180
+ go tool yq e ' .services.consent.image = "oryd/hydra-login-consent-node:' $$ DOCKER_TAG' "' -i quickstart.yml
201
181
202
182
licenses : .bin/licenses node_modules # checks open-source licenses
203
183
.bin/licenses
0 commit comments