Skip to content

Commit

Permalink
feat: install and use ginkgo at project level
Browse files Browse the repository at this point in the history
Currently, in the project the ginkgo cli tool is used by
some Makefile targets of the project and at Go level.

However, the project assumes that the cli tool is installed in the
user's environment. This leads to errors when trying to use
the Makefile targets and the user being confused as to why.

Aside from that, even if the user has the tool in the environment, the
version used by t might be different than the version that is specified
in go.mod, which might lead to errors when running the tool and
different observed behavior between users.

This set of changes ensures that the tools used by the Makefile are the
ones installed by it. This ensures that anyone that uses the project
and runs the ginkgo cli tool using the Makefile targets will use the same
version of the tool.

The tool is now always installed in the `bin` directory
of the project's path.

Users of the project that want to directly use the installed tool
manually should run it using the binary installed at project
level to ensure that there are no differences in the tool version.
  • Loading branch information
miguelsorianod committed Jan 26, 2024
1 parent 870abf3 commit 9c18ce7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ ginkgo_flags:=

.DEFAULT_GOAL := examples

GINKGO := $(LOCAL_BIN_PATH)/ginkgo
ginkgo-install:
@GOBIN=$(LOCAL_BIN_PATH) go install github.com/onsi/ginkgo/v2/ginkgo@v2.1.4 ;\

.PHONY: examples
examples:
cd examples && \
Expand All @@ -50,8 +54,8 @@ examples:
done

.PHONY: test tests
test tests:
ginkgo run -r $(ginkgo_flags)
test tests: ginkgo-install
$(GINKGO) run -r $(ginkgo_flags)

.PHONY: fmt
fmt:
Expand Down

0 comments on commit 9c18ce7

Please sign in to comment.