Skip to content

Commit

Permalink
Merge pull request #7 from kaleido-io/events
Browse files Browse the repository at this point in the history
Refactor FFCAPI to a local API interace, and FFTM to a utility package
  • Loading branch information
nguyer authored Aug 10, 2022
2 parents 9ab5b7a + b9bae85 commit 871d2ae
Show file tree
Hide file tree
Showing 147 changed files with 14,698 additions and 4,947 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/docker_main.yml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/docker_release.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
go-version: 1.17

- name: Build and Test
env:
TEST_FLAGS: -v
run: make

- name: Upload coverage
Expand Down
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ linters-settings:
enabled-checks: []
disabled-checks:
- regexpMust
gosec:
excludes:
- G402
goheader:
values:
regexp:
Expand Down
41 changes: 40 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,26 @@
"go.lintTool": "golangci-lint",
"cSpell.words": [
"APIID",
"apitypes",
"badurl",
"blocklistener",
"ccache",
"confirmationsmocks",
"dataexchange",
"Debugf",
"devdocs",
"Devel",
"distmode",
"Dont",
"ehtype",
"estype",
"ethconnect",
"ethtypes",
"eventsmocks",
"eventstream",
"eventstreams",
"fabconnect",
"ffapi",
"ffcapi",
"ffcapimocks",
"ffcore",
Expand All @@ -26,24 +39,43 @@
"ffresty",
"ffstruct",
"fftm",
"fftmrequest",
"fftypes",
"finalizers",
"getkin",
"GJSON",
"goleveldb",
"httpserver",
"hyperledger",
"idempotence",
"Infof",
"IPFS",
"jsonmap",
"Kaleido",
"leveldb",
"loadbalanced",
"logrus",
"mtxs",
"NATS",
"Nowarn",
"oapispec",
"oklog",
"openapi",
"optype",
"persistencemocks",
"pluggable",
"policyengine",
"policyenginemocks",
"policyengines",
"policyloop",
"protocolid",
"restapi",
"resty",
"santhosh",
"secp",
"sigs",
"stretchr",
"syndtr",
"sysmessaging",
"tekuri",
"tmconfig",
Expand All @@ -52,13 +84,20 @@
"txcommon",
"txcommonmocks",
"txid",
"txns",
"txtype",
"unflushed",
"unmarshalled",
"unmarshalling",
"upgrader",
"upsert",
"upserts",
"Warnf",
"whconfig",
"workloaddistribution",
"wsclient",
"wsconfig"
"wsconfig",
"wsmocks"
],
"go.testTimeout": "10s"
}
12 changes: 0 additions & 12 deletions Dockerfile

This file was deleted.

35 changes: 16 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VGO=go
GOFILES := $(shell find cmd internal pkg -name '*.go' -print)
GOFILES := $(shell find internal pkg -name '*.go' -print)
GOBIN := $(shell $(VGO) env GOPATH)/bin
LINT := $(GOBIN)/golangci-lint
MOCKERY := $(GOBIN)/mockery
Expand All @@ -12,43 +12,40 @@ GOGC=30

all: build test go-mod-tidy
test: deps lint
$(VGO) test ./internal/... ./cmd/... -cover -coverprofile=coverage.txt -covermode=atomic -timeout=30s
$(VGO) test ./internal/... ./pkg/... -cover -coverprofile=coverage.txt -covermode=atomic -timeout=30s ${TEST_FLAGS}
coverage.html:
$(VGO) tool cover -html=coverage.txt
coverage: test coverage.html
lint: ${LINT}
GOGC=20 $(LINT) run -v --timeout 5m
ffcapi:
$(eval FFCAPI_PATH := $(shell $(VGO) list -f '{{.Dir}}' github.com/hyperledger/firefly-common/pkg/ffcapi))


${MOCKERY}:
$(VGO) install github.com/vektra/mockery/cmd/mockery@latest
${LINT}:
$(VGO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
$(VGO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.0


define makemock
mocks: mocks-$(strip $(1))-$(strip $(2))
mocks-$(strip $(1))-$(strip $(2)): ${MOCKERY} ffcapi
mocks-$(strip $(1))-$(strip $(2)): ${MOCKERY}
${MOCKERY} --case underscore --dir $(1) --name $(2) --outpkg $(3) --output mocks/$(strip $(3))
endef

$(eval $(call makemock, $${FFCAPI_PATH}, API, ffcapimocks))
$(eval $(call makemock, pkg/policyengine, PolicyEngine, policyenginemocks))
$(eval $(call makemock, internal/confirmations, Manager, confirmationsmocks))
$(eval $(call makemock, internal/manager, Manager, managermocks))
$(eval $(call makemock, pkg/ffcapi, API, ffcapimocks))
$(eval $(call makemock, pkg/policyengine, PolicyEngine, policyenginemocks))
$(eval $(call makemock, internal/confirmations, Manager, confirmationsmocks))
$(eval $(call makemock, internal/persistence, Persistence, persistencemocks))
$(eval $(call makemock, internal/ws, WebSocketChannels, wsmocks))
$(eval $(call makemock, internal/events, Stream, eventsmocks))

firefly-transaction-manager: ${GOFILES}
$(VGO) build -o ./firefly-transaction-manager -ldflags "-X main.buildDate=`date -u +\"%Y-%m-%dT%H:%M:%SZ\"` -X main.buildVersion=$(BUILD_VERSION)" -tags=prod -tags=prod -v ./fftm
go-mod-tidy: .ALWAYS
$(VGO) mod tidy
build: firefly-transaction-manager
build: test
.ALWAYS: ;
clean:
$(VGO) clean
deps:
$(VGO) get ./fftm
docs:
$(VGO) test ./cmd -timeout=10s -tags docs
docker:
docker build --build-arg BUILD_VERSION=${BUILD_VERSION} ${DOCKER_ARGS} -t hyperledger/firefly-transaction-manager .
$(VGO) get ./internal/... ./pkg/...
$(VGO) get -t ./internal/... ./pkg/...
reference:
$(VGO) test ./pkg/fftm -timeout=10s -tags docs
102 changes: 0 additions & 102 deletions cmd/fftm.go

This file was deleted.

Loading

0 comments on commit 871d2ae

Please sign in to comment.