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

cocli: move cocli to a standalone repo #125

Merged
merged 1 commit into from
Aug 27, 2024
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
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,3 @@
# vendor/

mocks/

# Generated during testing
cocli/cocli
cocli/cmd/output.cbor
30 changes: 6 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@ GO111MODULE := on
GOPKG := github.com/veraison/corim/corim
GOPKG += github.com/veraison/corim/comid
GOPKG += github.com/veraison/corim/cots
GOPKG += github.com/veraison/corim/cocli/cmd
GOPKG += github.com/veraison/corim/encoding
GOPKG += github.com/veraison/corim/extensions

MOCKGEN := $(shell go env GOPATH)/bin/mockgen
INTERFACES := cocli/cmd/isubmitter.go
MOCKPKG := mocks

GOLINT ?= golangci-lint

ifeq ($(MAKECMDGOALS),lint)
Expand All @@ -26,7 +21,8 @@ else
endif

.PHONY: lint lint-extra
lint lint-extra: _mocks; $(GOLINT) $(GOLINT_ARGS)
lint lint-extra:
$(GOLINT) $(GOLINT_ARGS)

ifeq ($(MAKECMDGOALS),test)
GOTEST_ARGS ?= -v -race $(GOPKG)
Expand All @@ -38,28 +34,14 @@ endif

COVER_THRESHOLD := $(shell grep '^name: cover' .github/workflows/ci-go-cover.yml | cut -c13-)


define MOCK_template
mock_$(1): $(1)
$$(MOCKGEN) -source=$$< -destination=cocli/cmd/mocks/$$$$(basename $$@) -package=$$(MOCKPKG)
endef

$(foreach m,$(INTERFACES),$(eval $(call MOCK_template,$(m))))
MOCK_FILES := $(foreach m,$(INTERFACES),$(join mock_,$(m)))
CLEANFILES := $(MOCK_FILES)

_mocks: $(MOCK_FILES)
.PHONY: _mocks

.PHONY: test test-cover
test test-cover: _mocks; go test $(GOTEST_ARGS)
test test-cover:
go test $(GOTEST_ARGS)

realtest: _mocks; go test $(GOTEST_ARGS)
realtest:
go test $(GOTEST_ARGS)
.PHONY: realtest

.PHONY: clean
clean: ; $(RM) $(CLEANFILES)

presubmit:
@echo
@echo ">>> Check that the reported coverage figures are $(COVER_THRESHOLD)"
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ The [`corim/corim`](corim) and [`corim/comid`](comid) packages provide a golang
> These API are still in active development (as is the underlying CoRIM spec).
> They are **subject to change** in the future.

The [`corim/cocli`](cocli) package uses the API above (as well as the API from [`veraison/swid`](https://github.com/veraison/swid) package) to provide a user friendly command line interface for working with CoRIM, CoMID, CoSWID and CoTS. Specifically it allows creating, signing, verifying, displaying, uploading, and more. See [`cocli/README.md`](cocli/README.md) for further details.

## Developer tips

Before requesting a PR (and routinely during the dev/test cycle), you are encouraged to run:
Expand Down
Loading
Loading