1111# ORY_CONSOLE_API_URL - Console API URL (default: https://api.console.ory.sh)
1212# ORY_PROJECT_API_URL - Project API URL template (default: https://%s.projects.oryapis.com)
1313
14+ SHELL := /bin/bash -o pipefail
1415BINARY_NAME := terraform-provider-orynetwork
1516INSTALL_DIR := ~/.terraform.d/plugins/registry.terraform.io/ory/orynetwork/0.0.1/$(shell go env GOOS) _$(shell go env GOARCH)
1617
@@ -47,7 +48,7 @@ deps-ci: ## Install dependencies for CI environment
4748# Ory CLI for dependency management
4849.bin/ory :
4950 @mkdir -p .bin
50- @bash <( curl --retry 7 --retry-connrefused https://raw.githubusercontent.com/ory/meta/master/install.sh) -d -b .bin ory v0.3.4
51+ @curl --retry 7 --retry-connrefused -sSfL https://raw.githubusercontent.com/ory/meta/master/install.sh | bash -s -- -d -b .bin ory v0.3.4
5152 @touch -a -m .bin/ory
5253
5354# ==============================================================================
@@ -71,20 +72,44 @@ clean: ## Remove build artifacts
7172# CODE QUALITY
7273# ==============================================================================
7374
75+ # Code quality tool binaries
76+ .bin/golangci-lint : .deps/golangci-lint.yaml .bin/ory
77+ @mkdir -p .bin
78+ @URL=$$(.bin/ory dev ci deps url -o $(OS ) -a $(ARCH ) -c .deps/golangci-lint.yaml ) ; \
79+ echo " Downloading golangci-lint from $$ {URL}..." ; \
80+ curl -sSfL " $$ {URL}" | tar -xz -C .bin --strip-components=1 --wildcards ' */golangci-lint' ; \
81+ chmod +x .bin/golangci-lint
82+
83+ .bin/tfplugindocs : .deps/tfplugindocs.yaml .bin/ory
84+ @mkdir -p .bin
85+ @URL=$$(.bin/ory dev ci deps url -o $(OS ) -a $(ARCH ) -c .deps/tfplugindocs.yaml ) ; \
86+ echo " Downloading tfplugindocs from $$ {URL}..." ; \
87+ curl -sSfL " $$ {URL}" -o /tmp/tfplugindocs.zip; \
88+ unzip -q -o /tmp/tfplugindocs.zip -d .bin tfplugindocs; \
89+ rm /tmp/tfplugindocs.zip; \
90+ chmod +x .bin/tfplugindocs
91+
92+ .bin/go-licenses : .deps/go-licenses.yaml .bin/ory
93+ @VERSION=$$(.bin/ory dev ci deps url -o $(OS ) -a $(ARCH ) -c .deps/go-licenses.yaml ) ; \
94+ echo " Installing go-licenses $$ {VERSION}..." ; \
95+ GOBIN=$(PWD ) /.bin go install github.com/google/go-licenses@$$ {VERSION}
96+
7497.PHONY : format
75- format : # # Format all code (Go, Terraform, modules, docs, lint fixes)
98+ format : .bin/tfplugindocs .bin/golangci-lint # # Format all code (Go, Terraform, modules, docs, lint fixes)
7699 go fmt ./...
77100 gofmt -s -w .
78101 terraform fmt -recursive examples/
79102 go mod tidy
80- @command -v tfplugindocs > /dev/null 2>&1 || { echo " Installing tfplugindocs..." ; go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest; }
81- tfplugindocs generate --provider-name ory
82- @command -v golangci-lint > /dev/null 2>&1 || { echo " Installing golangci-lint v2..." ; go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest; }
83- golangci-lint run --fix ./...
103+ .bin/tfplugindocs generate --provider-name ory
104+ .bin/golangci-lint run --fix ./...
84105
85106.PHONY : lint
86- lint : # # Run Go linter (without fixes)
87- golangci-lint run ./...
107+ lint : .bin/golangci-lint # # Run Go linter (without fixes)
108+ .bin/golangci-lint run ./...
109+
110+ .PHONY : licenses
111+ licenses : .bin/go-licenses # # Check dependency licenses
112+ .bin/go-licenses check ./... --disallowed_types=forbidden,restricted
88113
89114# ==============================================================================
90115# TESTING
0 commit comments