mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 20:08:02 +00:00
2f91679623
This change adds a core_generate_all make target. It installs the required tools and runs generate on the complete project. `golang/mock` is no longer maintained and a fork is available from the Uber folks. So the latter is used as tool. All the mock files have been regenerated and are part of the PR. The obsolete `tools` directory has been removed, as all the tools are now part of specific make targets. Co-authored-by: Silvan <silvan.reusser@gmail.com>
125 lines
4.0 KiB
Makefile
125 lines
4.0 KiB
Makefile
go_bin := "$$(go env GOPATH)/bin"
|
|
gen_authopt_path := "$(go_bin)/protoc-gen-authoption"
|
|
gen_zitadel_path := "$(go_bin)/protoc-gen-zitadel"
|
|
|
|
now := $(shell date --rfc-3339=seconds | sed 's/ /T/')
|
|
VERSION ?= development-$(now)
|
|
COMMIT_SHA ?= $(shell git rev-parse HEAD)
|
|
|
|
.PHONY: compile
|
|
compile: core_build console_build compile_pipeline
|
|
|
|
.PHONY: compile_pipeline
|
|
compile_pipeline: console_move
|
|
CGO_ENABLED=0 go build -o zitadel -v -ldflags="-s -w -X 'github.com/zitadel/zitadel/cmd/build.commit=$(COMMIT_SHA)' -X 'github.com/zitadel/zitadel/cmd/build.date=$(now)' -X 'github.com/zitadel/zitadel/cmd/build.version=$(VERSION)' "
|
|
chmod +x zitadel
|
|
|
|
.PHONY: core_dependencies
|
|
core_dependencies:
|
|
go mod download
|
|
|
|
.PHONY: core_static
|
|
core_static:
|
|
go install github.com/rakyll/statik@v0.1.7
|
|
go generate internal/api/ui/login/static/resources/generate.go
|
|
go generate internal/api/ui/login/statik/generate.go
|
|
go generate internal/notification/statik/generate.go
|
|
go generate internal/statik/generate.go
|
|
|
|
.PHONY: core_generate_all
|
|
core_generate_all:
|
|
go install github.com/dmarkham/enumer@v1.5.9
|
|
go install github.com/rakyll/statik@v0.1.7
|
|
go install go.uber.org/mock/mockgen@v0.3.0
|
|
go install golang.org/x/tools/cmd/stringer@v0.15.0
|
|
go generate ./...
|
|
|
|
.PHONY: core_assets
|
|
core_assets:
|
|
mkdir -p docs/apis/assets
|
|
go run internal/api/assets/generator/asset_generator.go -directory=internal/api/assets/generator/ -assets=docs/apis/assets/assets.md
|
|
|
|
.PHONY: core_api_generator
|
|
core_api_generator:
|
|
ifeq (,$(wildcard $(gen_authopt_path)))
|
|
go install internal/protoc/protoc-gen-authoption/main.go \
|
|
&& mv $$(go env GOPATH)/bin/main $(gen_authopt_path)
|
|
endif
|
|
ifeq (,$(wildcard $(gen_zitadel_path)))
|
|
go install internal/protoc/protoc-gen-zitadel/main.go \
|
|
&& mv $$(go env GOPATH)/bin/main $(gen_zitadel_path)
|
|
endif
|
|
|
|
.PHONY: core_grpc_dependencies
|
|
core_grpc_dependencies:
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31
|
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3
|
|
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v2.18.1
|
|
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v2.18.1
|
|
go install github.com/envoyproxy/protoc-gen-validate@v1.0.2
|
|
go install github.com/bufbuild/buf/cmd/buf@v1.27.2
|
|
|
|
.PHONY: core_api
|
|
core_api: core_api_generator core_grpc_dependencies
|
|
buf generate
|
|
mkdir -p pkg/grpc
|
|
cp -r .artifacts/grpc/github.com/zitadel/zitadel/pkg/grpc/* pkg/grpc/
|
|
mkdir -p openapi/v2/zitadel
|
|
cp -r .artifacts/grpc/zitadel/ openapi/v2/zitadel
|
|
|
|
.PHONY: core_build
|
|
core_build: core_dependencies core_api core_static core_assets
|
|
|
|
.PHONY: console_move
|
|
console_move:
|
|
cp -r console/dist/console/* internal/api/ui/console/static
|
|
|
|
.PHONY: console_dependencies
|
|
console_dependencies:
|
|
cd console && \
|
|
yarn install --immutable
|
|
|
|
.PHONY: console_client
|
|
console_client:
|
|
cd console && \
|
|
yarn generate
|
|
|
|
.PHONY: console_build
|
|
console_build: console_dependencies console_client
|
|
cd console && \
|
|
yarn build
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
$(RM) -r .artifacts/grpc
|
|
$(RM) $(gen_authopt_path)
|
|
$(RM) $(gen_zitadel_path)
|
|
|
|
.PHONY: core_unit_test
|
|
core_unit_test:
|
|
go test -race -coverprofile=profile.cov ./...
|
|
|
|
.PHONY: core_integration_setup
|
|
core_integration_setup:
|
|
go build -o zitadel main.go
|
|
./zitadel init --config internal/integration/config/zitadel.yaml --config internal/integration/config/${INTEGRATION_DB_FLAVOR}.yaml
|
|
./zitadel setup --masterkeyFromEnv --config internal/integration/config/zitadel.yaml --config internal/integration/config/${INTEGRATION_DB_FLAVOR}.yaml
|
|
$(RM) zitadel
|
|
|
|
.PHONY: core_integration_test
|
|
core_integration_test: core_integration_setup
|
|
go test -tags=integration -race -p 1 -coverprofile=profile.cov -coverpkg=./internal/...,./cmd/... ./internal/integration ./internal/api/grpc/... ./internal/notification/handlers/... ./internal/api/oidc/...
|
|
|
|
.PHONY: console_lint
|
|
console_lint:
|
|
cd console && \
|
|
yarn lint
|
|
|
|
.PHONE: core_lint
|
|
core_lint:
|
|
golangci-lint run \
|
|
--timeout 10m \
|
|
--config ./.golangci.yaml \
|
|
--out-format=github-actions \
|
|
--concurrency=$$(getconf _NPROCESSORS_ONLN)
|