-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update makefile with the local bin installs
Signed-off-by: Martin Necas <[email protected]>
- Loading branch information
Showing
3 changed files
with
28 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,9 +78,6 @@ jobs: | |
with: | ||
go-version: '1.20' | ||
|
||
- name: Setup Goimports | ||
run: go install golang.org/x/tools/cmd/[email protected] | ||
|
||
- name: Generate code | ||
run: make generate | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,15 @@ model_url:=https://github.com/openshift-online/ocm-api-model.git | |
# Details of the metamodel to use: | ||
metamodel_version:=v0.0.59 | ||
|
||
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
PROJECT_PATH := $(patsubst %/,%,$(dir $(MKFILE_PATH))) | ||
LOCAL_BIN_PATH := $(PROJECT_PATH)/bin | ||
# Add the project-level bin directory into PATH. Needed in order | ||
# for `go generate` to use project-level bin directory binaries first | ||
export PATH := $(LOCAL_BIN_PATH):$(PATH) | ||
GINKGO := $(LOCAL_BIN_PATH)/ginkgo | ||
METAMODEL := $(LOCAL_BIN_PATH)/metamodel | ||
|
||
# Additional flags to pass to the `ginkgo` command. This is used in the GitHub | ||
# actions environment to skip tests that are sensitive to the speed of the | ||
# machine: the leadership flag and retry tests. | ||
|
@@ -36,9 +45,18 @@ examples: | |
go build $${i} || exit 1; \ | ||
done | ||
|
||
.PHONY: ginkgo-install | ||
ginkgo-install: | ||
@GOBIN=$(LOCAL_BIN_PATH) go install github.com/onsi/ginkgo/v2/[email protected] | ||
|
||
# Needed for the golang metamodel generator. | ||
.PHONY: goimports-install | ||
goimports-install: | ||
@GOBIN=$(LOCAL_BIN_PATH) go install golang.org/x/tools/cmd/[email protected] | ||
|
||
.PHONY: test tests | ||
test tests: | ||
ginkgo run -r $(ginkgo_flags) | ||
test tests: ginkgo-install | ||
$(GINKGO) run -r $(ginkgo_flags) | ||
|
||
.PHONY: fmt | ||
fmt: | ||
|
@@ -50,7 +68,7 @@ lint: | |
golangci-lint run | ||
|
||
.PHONY: generate | ||
generate: model metamodel | ||
generate: model metamodel goimports-install | ||
rm -rf \ | ||
accountsmgmt \ | ||
addonsmgmt \ | ||
|
@@ -65,11 +83,11 @@ generate: model metamodel | |
webrca \ | ||
osdfleetmgmt \ | ||
openapi | ||
metamodel generate go \ | ||
$(METAMODEL) generate go \ | ||
--model=model/model \ | ||
--base=github.com/openshift-online/ocm-sdk-go \ | ||
--output=. | ||
metamodel generate openapi \ | ||
$(METAMODEL) generate openapi \ | ||
--model=model/model \ | ||
--output=openapi | ||
|
||
|
@@ -87,11 +105,11 @@ model: | |
|
||
.PHONY: metamodel | ||
metamodel: | ||
go install github.com/openshift-online/ocm-api-metamodel/cmd/metamodel@$(metamodel_version) | ||
@GOBIN=$(LOCAL_BIN_PATH) go install github.com/openshift-online/ocm-api-metamodel/cmd/metamodel@$(metamodel_version) | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf \ | ||
metamodel \ | ||
bin \ | ||
model \ | ||
$(NULL) |