forked from mystiq/dex
refactor: tool dependency download
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
parent
054e397177
commit
f45fe6d0c1
2 changed files with 43 additions and 36 deletions
3
.github/workflows/ci.yaml
vendored
3
.github/workflows/ci.yaml
vendored
|
@ -78,6 +78,9 @@ jobs:
|
||||||
version: v0.11.1
|
version: v0.11.1
|
||||||
node_image: kindest/node:v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729
|
node_image: kindest/node:v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729
|
||||||
|
|
||||||
|
- name: Download tool dependencies
|
||||||
|
run: make deps
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: make testall
|
run: make testall
|
||||||
env:
|
env:
|
||||||
|
|
76
Makefile
76
Makefile
|
@ -1,9 +1,10 @@
|
||||||
OS = $(shell uname | tr A-Z a-z)
|
OS = $(shell uname | tr A-Z a-z)
|
||||||
|
|
||||||
|
export PATH := $(abspath bin/protoc/bin/):$(abspath bin/):${PATH}
|
||||||
|
|
||||||
PROJ=dex
|
PROJ=dex
|
||||||
ORG_PATH=github.com/dexidp
|
ORG_PATH=github.com/dexidp
|
||||||
REPO_PATH=$(ORG_PATH)/$(PROJ)
|
REPO_PATH=$(ORG_PATH)/$(PROJ)
|
||||||
export PATH := $(PWD)/bin:$(PATH)
|
|
||||||
|
|
||||||
VERSION ?= $(shell ./scripts/git-version)
|
VERSION ?= $(shell ./scripts/git-version)
|
||||||
|
|
||||||
|
@ -20,11 +21,6 @@ export GOBIN=$(PWD)/bin
|
||||||
LD_FLAGS="-w -X main.version=$(VERSION)"
|
LD_FLAGS="-w -X main.version=$(VERSION)"
|
||||||
|
|
||||||
# Dependency versions
|
# Dependency versions
|
||||||
GOLANGCI_VERSION = 1.42.0
|
|
||||||
|
|
||||||
PROTOC_VERSION = 3.15.6
|
|
||||||
PROTOC_GEN_GO_VERSION = 1.26.0
|
|
||||||
PROTOC_GEN_GO_GRPC_VERSION = 1.1.0
|
|
||||||
|
|
||||||
KIND_NODE_IMAGE = "kindest/node:v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729"
|
KIND_NODE_IMAGE = "kindest/node:v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729"
|
||||||
KIND_TMP_DIR = "$(PWD)/bin/test/dex-kind-kubeconfig"
|
KIND_TMP_DIR = "$(PWD)/bin/test/dex-kind-kubeconfig"
|
||||||
|
@ -83,19 +79,13 @@ kind-down:
|
||||||
kind-tests: export DEX_KUBERNETES_CONFIG_PATH=${KIND_TMP_DIR}
|
kind-tests: export DEX_KUBERNETES_CONFIG_PATH=${KIND_TMP_DIR}
|
||||||
kind-tests: testall
|
kind-tests: testall
|
||||||
|
|
||||||
bin/golangci-lint: bin/golangci-lint-${GOLANGCI_VERSION}
|
|
||||||
@ln -sf golangci-lint-${GOLANGCI_VERSION} bin/golangci-lint
|
|
||||||
bin/golangci-lint-${GOLANGCI_VERSION}:
|
|
||||||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint bash -s -- v${GOLANGCI_VERSION}
|
|
||||||
@mv bin/golangci-lint $@
|
|
||||||
|
|
||||||
.PHONY: lint lint-fix
|
.PHONY: lint lint-fix
|
||||||
lint: bin/golangci-lint ## Run linter
|
lint: ## Run linter
|
||||||
bin/golangci-lint run
|
golangci-lint run
|
||||||
|
|
||||||
.PHONY: fix
|
.PHONY: fix
|
||||||
fix: bin/golangci-lint ## Fix lint violations
|
fix: ## Fix lint violations
|
||||||
bin/golangci-lint run --fix
|
golangci-lint run --fix
|
||||||
|
|
||||||
.PHONY: docker-image
|
.PHONY: docker-image
|
||||||
docker-image:
|
docker-image:
|
||||||
|
@ -115,36 +105,50 @@ FORCE:
|
||||||
.PHONY: test testrace testall
|
.PHONY: test testrace testall
|
||||||
|
|
||||||
.PHONY: proto
|
.PHONY: proto
|
||||||
proto: bin/protoc bin/protoc-gen-go bin/protoc-gen-go-grpc
|
proto:
|
||||||
@./bin/protoc --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:. --plugin=protoc-gen-go=./bin/protoc-gen-go --plugin=protoc-gen-go-grpc=./bin/protoc-gen-go-grpc api/v2/*.proto
|
@protoc --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:. api/v2/*.proto
|
||||||
@./bin/protoc --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:. --plugin=protoc-gen-go=./bin/protoc-gen-go --plugin=protoc-gen-go-grpc=./bin/protoc-gen-go-grpc api/*.proto
|
@protoc --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:. api/*.proto
|
||||||
#@cp api/v2/*.proto api/
|
#@cp api/v2/*.proto api/
|
||||||
|
|
||||||
.PHONY: proto-internal
|
.PHONY: proto-internal
|
||||||
proto-internal: bin/protoc bin/protoc-gen-go
|
proto-internal:
|
||||||
@./bin/protoc --go_out=paths=source_relative:. --plugin=protoc-gen-go=./bin/protoc-gen-go server/internal/*.proto
|
@protoc --go_out=paths=source_relative:. server/internal/*.proto
|
||||||
|
|
||||||
bin/protoc: bin/protoc-${PROTOC_VERSION}
|
# Dependency versions
|
||||||
@ln -sf protoc-${PROTOC_VERSION}/bin/protoc bin/protoc
|
GOLANGCI_VERSION = 1.42.0
|
||||||
bin/protoc-${PROTOC_VERSION}:
|
GOTESTSUM_VERSION ?= 1.7.0
|
||||||
@mkdir -p bin/protoc-${PROTOC_VERSION}
|
PROTOC_VERSION = 3.15.6
|
||||||
ifeq (${OS}, darwin)
|
PROTOC_GEN_GO_VERSION = 1.26.0
|
||||||
|
PROTOC_GEN_GO_GRPC_VERSION = 1.1.0
|
||||||
|
|
||||||
|
deps: bin/gotestsum bin/golangci-lint bin/protoc bin/protoc-gen-go bin/protoc-gen-go-grpc
|
||||||
|
|
||||||
|
bin/gotestsum:
|
||||||
|
@mkdir -p bin
|
||||||
|
curl -L https://github.com/gotestyourself/gotestsum/releases/download/v${GOTESTSUM_VERSION}/gotestsum_${GOTESTSUM_VERSION}_$(shell uname | tr A-Z a-z)_amd64.tar.gz | tar -zOxf - gotestsum > ./bin/gotestsum
|
||||||
|
@chmod +x ./bin/gotestsum
|
||||||
|
|
||||||
|
bin/golangci-lint:
|
||||||
|
@mkdir -p bin
|
||||||
|
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint bash -s -- v${GOLANGCI_VERSION}
|
||||||
|
|
||||||
|
bin/protoc:
|
||||||
|
@mkdir -p bin/protoc
|
||||||
|
ifeq ($(shell uname | tr A-Z a-z), darwin)
|
||||||
curl -L https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-x86_64.zip > bin/protoc.zip
|
curl -L https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-x86_64.zip > bin/protoc.zip
|
||||||
endif
|
endif
|
||||||
ifeq (${OS}, linux)
|
ifeq ($(shell uname | tr A-Z a-z), linux)
|
||||||
curl -L https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip > bin/protoc.zip
|
curl -L https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip > bin/protoc.zip
|
||||||
endif
|
endif
|
||||||
unzip bin/protoc.zip -d bin/protoc-${PROTOC_VERSION}
|
unzip bin/protoc.zip -d bin/protoc
|
||||||
rm bin/protoc.zip
|
rm bin/protoc.zip
|
||||||
|
|
||||||
bin/protoc-gen-go: bin/protoc-gen-go-${PROTOC_GEN_GO_VERSION}
|
bin/protoc-gen-go:
|
||||||
@ln -sf protoc-gen-go-${PROTOC_GEN_GO_VERSION} bin/protoc-gen-go
|
|
||||||
bin/protoc-gen-go-${PROTOC_GEN_GO_VERSION}:
|
|
||||||
@mkdir -p bin
|
@mkdir -p bin
|
||||||
curl -L https://github.com/protocolbuffers/protobuf-go/releases/download/v${PROTOC_GEN_GO_VERSION}/protoc-gen-go.v${PROTOC_GEN_GO_VERSION}.${OS}.amd64.tar.gz | tar -zOxf - protoc-gen-go > ./bin/protoc-gen-go-${PROTOC_GEN_GO_VERSION} && chmod +x ./bin/protoc-gen-go-${PROTOC_GEN_GO_VERSION}
|
curl -L https://github.com/protocolbuffers/protobuf-go/releases/download/v${PROTOC_GEN_GO_VERSION}/protoc-gen-go.v${PROTOC_GEN_GO_VERSION}.$(shell uname | tr A-Z a-z).amd64.tar.gz | tar -zOxf - protoc-gen-go > ./bin/protoc-gen-go
|
||||||
|
@chmod +x ./bin/protoc-gen-go
|
||||||
|
|
||||||
bin/protoc-gen-go-grpc: bin/protoc-gen-go-grpc-${PROTOC_GEN_GO_GRPC_VERSION}
|
bin/protoc-gen-go-grpc:
|
||||||
@ln -sf protoc-gen-go-grpc-${PROTOC_GEN_GO_GRPC_VERSION} bin/protoc-gen-go-grpc
|
|
||||||
bin/protoc-gen-go-grpc-${PROTOC_GEN_GO_GRPC_VERSION}:
|
|
||||||
@mkdir -p bin
|
@mkdir -p bin
|
||||||
curl -L https://github.com/grpc/grpc-go/releases/download/cmd%2Fprotoc-gen-go-grpc%2Fv${PROTOC_GEN_GO_GRPC_VERSION}/protoc-gen-go-grpc.v${PROTOC_GEN_GO_GRPC_VERSION}.${OS}.amd64.tar.gz | tar -zOxf - ./protoc-gen-go-grpc > ./bin/protoc-gen-go-grpc-${PROTOC_GEN_GO_GRPC_VERSION} && chmod +x ./bin/protoc-gen-go-grpc-${PROTOC_GEN_GO_GRPC_VERSION}
|
curl -L https://github.com/grpc/grpc-go/releases/download/cmd/protoc-gen-go-grpc/v${PROTOC_GEN_GO_GRPC_VERSION}/protoc-gen-go-grpc.v${PROTOC_GEN_GO_GRPC_VERSION}.$(shell uname | tr A-Z a-z).amd64.tar.gz | tar -zOxf - ./protoc-gen-go-grpc > ./bin/protoc-gen-go-grpc
|
||||||
|
@chmod +x ./bin/protoc-gen-go-grpc
|
||||||
|
|
Loading…
Reference in a new issue