-
-
Notifications
You must be signed in to change notification settings - Fork 362
/
Makefile
106 lines (83 loc) · 3.31 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
SHELL=/bin/bash -o pipefail
export GO111MODULE := on
export PATH := .bin:${PATH}
export PWD := $(shell pwd)
export IMAGE_TAG := $(if $(IMAGE_TAG),$(IMAGE_TAG),dev)
GO_DEPENDENCIES = github.com/ory/go-acc \
github.com/go-swagger/go-swagger/cmd/swagger \
github.com/go-bindata/go-bindata/go-bindata
define make-go-dependency
# go install is responsible for not re-building when the code hasn't changed
.bin/$(notdir $1): go.sum go.mod
GOBIN=$(PWD)/.bin/ go install $1
endef
$(foreach dep, $(GO_DEPENDENCIES), $(eval $(call make-go-dependency, $(dep))))
node_modules: package-lock.json
npm ci
touch node_modules
.bin/clidoc: go.mod
go build -o .bin/clidoc ./cmd/clidoc/.
.bin/goimports: Makefile
GOBIN=$(shell pwd)/.bin go install golang.org/x/tools/cmd/goimports@latest
.bin/licenses: Makefile
curl https://raw.githubusercontent.com/ory/ci/master/licenses/install | sh
.bin/ory: Makefile
curl https://raw.githubusercontent.com/ory/meta/master/install.sh | bash -s -- -b .bin ory v0.2.2
touch .bin/ory
.bin/golangci-lint: Makefile
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -d -b .bin v1.56.2
authors: # updates the AUTHORS file
curl https://raw.githubusercontent.com/ory/ci/master/authors/authors.sh | env PRODUCT="Ory Oathkeeper" bash
.PHONY: format
format: .bin/goimports .bin/ory node_modules
.bin/ory dev headers copyright --type=open-source --exclude=internal/httpclient
goimports -w --local github.com/ory .
gofmt -l -s -w .
npm exec -- prettier --write .
.PHONY: lint
lint: .bin/golangci-lint
.bin/golangci-lint run --timeout 10m0s
licenses: .bin/licenses node_modules # checks open-source licenses
.bin/licenses
# Generates the SDK
.PHONY: sdk
sdk: .bin/swagger .bin/ory node_modules
rm -rf internal/httpclient
mkdir -p internal/httpclient
swagger generate spec -m -o spec/swagger.json \
-c github.com/ory/oathkeeper \
-c github.com/ory/x/healthx
ory dev swagger sanitize ./spec/swagger.json
swagger validate ./spec/swagger.json
CIRCLE_PROJECT_USERNAME=ory CIRCLE_PROJECT_REPONAME=oathkeeper \
ory dev openapi migrate \
--health-path-tags metadata \
-p https://raw.githubusercontent.com/ory/x/master/healthx/openapi/patch.yaml \
-p file://.schema/openapi/patches/meta.yaml \
spec/swagger.json spec/api.json
swagger generate client -f ./spec/swagger.json -t internal/httpclient -A Ory_Oathkeeper
make --no-print-dir format
.PHONY: install-stable
install-stable:
OATHKEEPER_LATEST=$$(git describe --abbrev=0 --tags)
git checkout $$OATHKEEPER_LATEST
GO111MODULE=on go install \
-ldflags "-X github.com/ory/oathkeeper/x.Version=$$OATHKEEPER_LATEST -X github.com/ory/oathkeeper/x.Date=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'` -X github.com/ory/oathkeeper/x.Commit=`git rev-parse HEAD`" \
.
git checkout master
.PHONY: install
install:
GO111MODULE=on go install .
.PHONY: docker
docker:
DOCKER_BUILDKIT=1 DOCKER_CONTENT_TRUST=1 docker build -t oryd/oathkeeper:${IMAGE_TAG} --progress=plain -f .docker/Dockerfile-build .
.PHONY: docker-k3d
docker-k3d:
CGO_ENABLED=0 GOOS=linux go build
DOCKER_BUILDKIT=1 DOCKER_CONTENT_TRUST=1 docker build -t k3d-localhost:5111/oryd/oathkeeper:dev --push -f .docker/Dockerfile-distroless-static .
rm oathkeeper
docs/cli: .bin/clidoc
clidoc .
.PHONY: post-release
post-release:
echo "nothing to do"