Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: install and use tools at project scope level #850

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/check-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
!/examples/*.yaml
!/examples/go.mod
!/examples/go.sum

# local bin directory
/bin
26 changes: 21 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
#
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 the tasks to use project-level bin directory binaries first
export PATH := $(LOCAL_BIN_PATH):$(PATH)

# Disable CGO so that we always generate static binaries:
export CGO_ENABLED=0
Expand All @@ -24,6 +33,8 @@ model_url:=https://github.com/openshift-online/ocm-api-model.git
# Details of the metamodel to use:
metamodel_version:=v0.0.59

goimports_version:=v0.4.0

# 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.
Expand All @@ -50,7 +61,7 @@ lint:
golangci-lint run

.PHONY: generate
generate: model metamodel
generate: model metamodel-install goimports-install
rm -rf \
accountsmgmt \
addonsmgmt \
Expand All @@ -65,11 +76,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

Expand All @@ -86,8 +97,13 @@ model:
fi

.PHONY: metamodel
metamodel:
go install github.com/openshift-online/ocm-api-metamodel/cmd/metamodel@$(metamodel_version)
METAMODEL=$(LOCAL_BIN_PATH)/metamodel
metamodel-install:
GOBIN=$(LOCAL_BIN_PATH) go install github.com/openshift-online/ocm-api-metamodel/cmd/metamodel@$(metamodel_version)

.PHONY: goimports
goimports-install:
@GOBIN=$(LOCAL_BIN_PATH) go install golang.org/x/tools/cmd/goimports@$(goimports_version)

.PHONY: clean
clean:
Expand Down
Loading