generated from cheqd/.github
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Fix resolver for cheqd-node 1.x release on mainnet [DEV-2238] (#94
) * Fix problem with deference resource data with old DID format * Fix problem with get all APIs resources with old DID * Update unit tests * Add integration tests for getting resources API with old DID * Format integration tests files * Remove duplicate import * Add implementation to redirect OLD DID to new DID URL * Fix golangci-lint mistake * Update unit tests * Fix problem with view fragment in URL * Add integration tests for testing old DID with fragment * Remove unused functions and variables * Refactor integration tests * Fix golangci-lint mistakes * Remove incorrect file push * Generate OpenAPI swagger * Rename command 'docker-compose' to 'docker compose' * Update swagger openAPI * Update dead link in README.md * Fix golangci-lint mistakes * Update openAPI swagger * Fix golangci-lint mistakes * Fix typo * Refactor main.go * Move ResolutionResourceMetadata type from did_doc_metadata.go to resource_metadata.go * Replace deprecated goreleaser property * Update .goreleaser.yml * revert: labstack/echo/v4 bump * Roll everything back * rename to production-latest * Delete production-latest.env * Delete container.env * Move variables to Docker Compose file * Set default variables in Dockerfile * Create docker-compose.yml * Delete docker-compose.env * Delete docker-compose.yml * Rename Dockerfile * Update test.yml * Restore Code of Conduct file * Update README.md * Fix environment section format * Reset go mod to see if it works * Update field in DIDDoc metadata can be skipped if it's not populated * Refactor code * Refactor code * Fix problem with version_id in snake case, currently It print in camelCase * /did/metadata: This only outputs the resource metadata. This should be the full contents of the didDocumentMetadata section. * Refactor unit test * Add a new API endpoint for fetching metadata for specific version of DIDDoc * Add integration test for testing a new API: /:did/version/:version/metadata * Generate swagger openAPI * Refactor code * Fix problem with swagger API * Add a new API comments for swagger OpenAPI * Generate swagger OpenAPI by last commit changes * Generate swagger OpenAPI * Update package-lock.json * Create Makefile * make swagger * swag fmt * Update go.mod * swag general info * delete docs folder * swag init * Update Makefile * mod tidy * Update Makefile * Update .goreleaser.yml * Add build-binary workflow * Fix Goreleaser archive rlcp warning * Update build statement in CodeQL * Update main.go * Update main.go * Update make swagger * Update Dockerfile * Update root.go * Update .golangci.yaml * Fix gocritic check * Update main.go * Disable stylecheck for now * Fix unlambda check * Update build.yml * Update Makefile --------- Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>
- Loading branch information
1 parent
1853115
commit 18658ab
Showing
40 changed files
with
1,568 additions
and
405 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 |
---|---|---|
@@ -1,29 +1,64 @@ | ||
run: | ||
timeout: 5m | ||
timeout: 10m | ||
|
||
|
||
linters: | ||
enable: | ||
- deadcode | ||
- bodyclose | ||
- depguard | ||
- dogsled | ||
- errcheck | ||
- gosimple | ||
- exportloopref | ||
- goconst | ||
- gocritic | ||
- gofumpt | ||
- goimports | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- nestif | ||
- nolintlint | ||
- staticcheck | ||
- structcheck | ||
# - stylecheck # Disable stylecheck until refactor | ||
- typecheck | ||
- unconvert | ||
- unused | ||
- varcheck | ||
|
||
|
||
linters-settings: | ||
dogsled: | ||
# Checks assignments with too many blank identifiers. | ||
# Default: 2 | ||
max-blank-identifiers: 3 | ||
|
||
gocritic: | ||
# Which checks should be disabled; can't be combined with 'enabled-checks'. | ||
# See https://go-critic.github.io/overview#checks-overview. | ||
# Default: [] | ||
disabled-checks: | ||
- regexpMust | ||
- badCall # Remove this after CI workflow PR | ||
|
||
gofumpt: | ||
lang-version: "1.18" | ||
|
||
misspell: | ||
ignore-words: | ||
- cheqd | ||
- cheq | ||
- ncheq | ||
|
||
stylecheck: | ||
# Select the Go version to target. | ||
go: "1.18" | ||
# STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks | ||
# Default: ["*"] | ||
checks: ["all"] | ||
# https://staticcheck.io/docs/configuration/options/#dot_import_whitelist | ||
dot-import-whitelist: | ||
- "github.com/cheqd/cheqd-node/x/did/utils" | ||
- "github.com/onsi/gomega" | ||
# https://staticcheck.io/docs/configuration/options/#initialisms | ||
initialisms: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"] |
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
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
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 |
---|---|---|
@@ -0,0 +1,157 @@ | ||
#!/usr/bin/make -f | ||
|
||
|
||
export GO111MODULE = on | ||
|
||
BUILD_DIR ?= $(CURDIR)/build | ||
|
||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD) | ||
COMMIT := $(shell git log -1 --format='%H') | ||
|
||
ifeq (,$(VERSION)) | ||
VERSION := $(shell git describe --exact-match 2>/dev/null) | ||
ifeq (,$(VERSION)) | ||
VERSION := $(BRANCH)-$(COMMIT) | ||
endif | ||
endif | ||
|
||
|
||
############################################################################### | ||
### All ### | ||
############################################################################### | ||
|
||
all: lint build | ||
|
||
############################################################################### | ||
### Build flags ### | ||
############################################################################### | ||
|
||
# Process build tags | ||
|
||
build_tags := | ||
empty := | ||
whitespace := $(empty) $(empty) | ||
comma := , | ||
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags)) | ||
build_tags += $(BUILD_TAGS) | ||
build_tags := $(strip $(build_tags)) | ||
|
||
# Process linker flags | ||
|
||
ldflags = -X github.com/cheqd/did-resolver/cmd.version=$(VERSION) \ | ||
-X github.com/cheqd/did-resolver/cmd.Commit=$(COMMIT) | ||
|
||
ifeq ($(LINK_STATICALLY),true) | ||
ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static" | ||
endif | ||
|
||
ifeq ($(NO_STRIP),false) | ||
ldflags += -w -s | ||
endif | ||
|
||
ldflags += $(LD_FLAGS) | ||
ldflags := $(strip $(ldflags)) | ||
|
||
# Set build flags | ||
|
||
BUILD_FLAGS := -tags '$(build_tags)' -ldflags '$(ldflags)' | ||
|
||
ifeq ($(NO_STRIP),false) | ||
BUILD_FLAGS += -trimpath | ||
endif | ||
|
||
############################################################################### | ||
### Build ### | ||
############################################################################### | ||
|
||
build: go.sum go-version | ||
@echo "Building DID Resolver binary..." | ||
@mkdir -p $(BUILD_DIR) | ||
@echo $(BUILD_FLAGS) | ||
@go build -mod=readonly $(BUILD_FLAGS) -o build/did-resolver main.go | ||
.PHONY: build | ||
|
||
############################################################################### | ||
### Install ### | ||
############################################################################### | ||
|
||
install: go.sum go-version | ||
@echo "Installing DID Resolver binary..." | ||
@go install -mod=readonly $(BUILD_FLAGS) | ||
.PHONY: install | ||
|
||
############################################################################### | ||
### Go Version ### | ||
############################################################################### | ||
|
||
GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1) | ||
GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) | ||
MIN_GO_MAJOR_VERSION = 1 | ||
MIN_GO_MINOR_VERSION = 18 | ||
GO_VERSION_ERROR = Golang version $(GO_MAJOR_VERSION).$(GO_MINOR_VERSION) is not supported, \ | ||
please update to at least $(MIN_GO_MAJOR_VERSION).$(MIN_GO_MINOR_VERSION) | ||
|
||
go-version: | ||
@echo "Verifying go version..." | ||
@if [ $(GO_MAJOR_VERSION) -gt $(MIN_GO_MAJOR_VERSION) ]; then \ | ||
exit 0; \ | ||
elif [ $(GO_MAJOR_VERSION) -lt $(MIN_GO_MAJOR_VERSION) ]; then \ | ||
echo $(GO_VERSION_ERROR); \ | ||
exit 1; \ | ||
elif [ $(GO_MINOR_VERSION) -lt $(MIN_GO_MINOR_VERSION) ]; then \ | ||
echo $(GO_VERSION_ERROR); \ | ||
exit 1; \ | ||
fi | ||
|
||
.PHONY: go-version | ||
|
||
############################################################################### | ||
### Go Modules ### | ||
############################################################################### | ||
|
||
go.sum: go.mod | ||
@echo "Ensuring app dependencies have not been modified..." | ||
go mod verify | ||
go mod tidy | ||
|
||
verify: | ||
@echo "Verifying all go module dependencies..." | ||
@find . -name 'go.mod' -type f -execdir go mod verify \; | ||
|
||
tidy: | ||
@echo "Cleaning up all go module dependencies..." | ||
@find . -name 'go.mod' -type f -execdir go mod tidy \; | ||
|
||
.PHONY: verify tidy | ||
|
||
############################################################################### | ||
### Tests & Simulation ### | ||
############################################################################### | ||
|
||
lint: | ||
golangci-lint run --out-format=tab | ||
|
||
lint-fix: | ||
golangci-lint run --fix --out-format=tab --issues-exit-code=0 | ||
.PHONY: lint lint-fix | ||
|
||
format: | ||
find . -name '*.go' -type f -not -path "*.git*" | xargs gofmt -w -s | ||
find . -name '*.go' -type f -not -path "*.git*" | xargs misspell -w | ||
find . -name '*.go' -type f -not -path "*.git*" | xargs goimports -w -local github.com/cheqd/bdjuno | ||
.PHONY: format | ||
|
||
clean: | ||
rm -rf $(BUILD_DIR) | ||
.PHONY: clean | ||
|
||
############################################################################### | ||
### Swagger ### | ||
############################################################################### | ||
|
||
swagger: | ||
@echo "Generating Swagger files..." | ||
@go install github.com/swaggo/swag/cmd/swag@latest | ||
@swag fmt | ||
@swag init -g main.go | ||
.PHONY: swagger |
Oops, something went wrong.