Skip to content

Commit

Permalink
feat(release): v1.x Release (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eengineer1 authored Jan 16, 2023
2 parents e29119d + 583be08 commit c78d712
Show file tree
Hide file tree
Showing 265 changed files with 38,467 additions and 4,121 deletions.
45 changes: 40 additions & 5 deletions .github/linters/.golangci.yaml
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
- 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"]
11 changes: 11 additions & 0 deletions .github/linters/.openapirc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

##########################
##########################
## OpenAPI Linter rules ##
##########################
##########################

extends: spectral:oas
rules:
oas2-schema: warn
8 changes: 5 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.47
version: v1.49.0
args: --config .github/linters/.golangci.yaml

proto-lint:
Expand All @@ -64,12 +64,14 @@ jobs:

# Lint
- uses: bufbuild/buf-lint-action@v1
with:
input: proto

# Breaking change detection
- uses: bufbuild/buf-breaking-action@v1
continue-on-error: true
with:
input: 'proto'
input: proto
against: 'https://github.com/cheqd/cheqd-node.git#branch=main,ref=HEAD~1,subdir=proto'

super-lint:
Expand All @@ -88,7 +90,7 @@ jobs:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOG_LEVEL: WARN
VALIDATE_ALL_CODEBASE: true
VALIDATE_ALL_CODEBASE: false
MULTI_STATUS: true

VALIDATE_BASH: true
Expand Down
40 changes: 36 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,41 @@ permissions:


jobs:
# Super Linter only runs on diffs in PRs
# For release, we run it on VALIDATE_ALL_CODEBASE=true
# List of languages enabled is smaller than in lint workflow
super-lint:
name: "Super Linter"
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required to fetch version

- name: Run Super Linter
uses: github/super-linter/slim@v4
env:
IGNORE_GITIGNORED_FILES: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOG_LEVEL: WARN
VALIDATE_ALL_CODEBASE: true
MULTI_STATUS: true

VALIDATE_BASH: true
VALIDATE_DOCKERFILE_HADOLINT: true
VALIDATE_JSON: true
VALIDATE_OPENAPI: true
VALIDATE_PYTHON_PYLINT: true
VALIDATE_XML: true
VALIDATE_YAML: true


release-binary:
name: "Node binary"
runs-on: ubuntu-20.04
needs: super-lint
outputs:
RELEASE_VERSION: ${{ steps.set-version.outputs.RELEASE_VERSION }}

Expand All @@ -36,7 +67,7 @@ jobs:
cache-dependency-path: '**/package-lock.json'

# Setup for pushing to Buf.build later
- uses: bufbuild/buf-setup-action@v1.11.0
- uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -68,18 +99,19 @@ jobs:
- name: Set release version number
id: set-version
run: |
RELEASE_VERSION=$( git describe --tags ${{ github.sha }})
echo ::set-output name=RELEASE_VERSION::"$RELEASE_VERSION"
RELEASE_VERSION=$( git describe --tags "${{ github.sha }}")
echo "RELEASE_VERSION=$RELEASE_VERSION" >> "$GITHUB_OUTPUT"
# Push Protobufs to Buf.build registry
- uses: bufbuild/buf-push-action@v1
with:
input: proto
buf_token: ${{ secrets.BUF_TOKEN }}
draft: ${{ github.ref_name != 'main'}}

release-docker:
name: "Docker image"
needs: release-binary
needs: [ super-lint, release-binary ]
runs-on: ubuntu-20.04
env:
IMAGE_NAME: ${{ github.repository }}
Expand Down
19 changes: 9 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
### APP-SPECIFIC EXCLUSIONS ###

# Ignored directories
api/docs/cheqd/**
api/docs/swagger-ui/**
build/
dist/

# Tests
**/network-config
**/node_configs

# Python
.pytest_cache
**/__pycache__
# Ignored files
api/docs/config.yaml

# Allowed files
!api/docs/swagger-ui/**/swagger-initializer.js

### GENERAL EXCLUSIONS ###

Expand Down Expand Up @@ -93,10 +96,6 @@ Temporary Items
# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work


### Node/JavaScript ###
# Logs
logs
Expand Down
9 changes: 5 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ env:
before:
hooks:
- make clean
- go mod tidy
- go mod download
- make tidy
- make install
- make proto-gen
- make swagger

builds:
- id: ubuntu-latest-amd64
Expand All @@ -22,7 +23,7 @@ builds:
- CGO_ENABLED=1
flags:
- -mod=readonly
- -tags="netgo ledger"
- -tags="netgo ledger goleveldb"
- -trimpath
ldflags:
- -s -w
Expand All @@ -42,7 +43,7 @@ builds:
- sudo apt update && sudo apt install clang gcc-multilib g++-multilib -y
flags:
- -mod=readonly
- -tags="netgo ledger"
- -tags="netgo ledger goleveldb"
- -trimpath
ldflags:
- -s -w
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ clean:
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 = 17
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)

Expand Down Expand Up @@ -245,6 +245,5 @@ include make/proto.mk
###############################################################################

swagger: proto-swagger-gen
@./scripts/generate_swagger_docs.sh

.PHONY: swagger
2 changes: 1 addition & 1 deletion ante/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func IsSufficientFee(ctx sdk.Context, tax, reward, burn, feeProvided sdk.Coins,

// Determine the required fees by multiplying each required minimum gas
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
glDec := sdk.NewDec(int64(gasRequested))
glDec := sdk.NewDec(gasRequested)
for i, gp := range minGasPrices {
fee := gp.Amount.Mul(glDec)
requiredFees[i] = sdk.NewCoin(gp.Denom, fee.Ceil().RoundInt())
Expand Down
4 changes: 2 additions & 2 deletions ante/testdata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func SandboxDidDoc() *didtypes.MsgCreateDidDoc {
var signatures []*didtypes.SignInfo

signatures = append(signatures, &didtypes.SignInfo{
VerificationMethodId: didDocInfo.SignInput.VerificationMethodId,
VerificationMethodId: didDocInfo.SignInput.VerificationMethodID,
Signature: ed25519.Sign(didDocInfo.SignInput.Key, signBytes),
})

Expand All @@ -41,7 +41,7 @@ func SandboxResource() *resourcetypes.MsgCreateResource {
var signatures []*didtypes.SignInfo

signatures = append(signatures, &didtypes.SignInfo{
VerificationMethodId: didDocInfo.SignInput.VerificationMethodId,
VerificationMethodId: didDocInfo.SignInput.VerificationMethodID,
Signature: ed25519.Sign(didDocInfo.SignInput.Key, signBytes),
})

Expand Down
2 changes: 1 addition & 1 deletion ante/testutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (s *AnteTestSuite) CreateTestAccounts(numAccs int) ([]TestAccount, error) {
func (s *AnteTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, accNums []uint64, accSeqs []uint64, chainID string) (xauthsigning.Tx, error) {
// First round: we gather all the signer infos. We use the "set empty
// signature" hack to do that.
var sigsV2 []signing.SignatureV2
sigsV2 := make([]signing.SignatureV2, 0, len(privs))
for i, priv := range privs {
sigV2 := signing.SignatureV2{
PubKey: priv.PubKey(),
Expand Down
10 changes: 5 additions & 5 deletions ante/tx_msg_filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
MsgDeactivateDidDoc
MsgCreateResourceDefault
MsgCreateResourceImage
MsgCreateResourceJson
MsgCreateResourceJSON

TaxableMsgFeeCount
)
Expand All @@ -37,7 +37,7 @@ var TaxableMsgFees = TaxableMsgFee{
MsgDeactivateDidDoc: (sdk.Coins)(nil),
MsgCreateResourceDefault: (sdk.Coins)(nil),
MsgCreateResourceImage: (sdk.Coins)(nil),
MsgCreateResourceJson: (sdk.Coins)(nil),
MsgCreateResourceJSON: (sdk.Coins)(nil),
}

var BurnFactors = BurnFactor{
Expand Down Expand Up @@ -97,8 +97,8 @@ func GetResourceTaxableMsgFee(ctx sdk.Context, msg *resourcetypes.MsgCreateResou

// Mime type json
if strings.HasPrefix(mediaType, "application/json") {
burnPortion := GetBurnFeePortion(BurnFactors[BurnFactorResource], TaxableMsgFees[MsgCreateResourceJson])
return GetRewardPortion(TaxableMsgFees[MsgCreateResourceJson], burnPortion), burnPortion, true
burnPortion := GetBurnFeePortion(BurnFactors[BurnFactorResource], TaxableMsgFees[MsgCreateResourceJSON])
return GetRewardPortion(TaxableMsgFees[MsgCreateResourceJSON], burnPortion), burnPortion, true
}

// Default mime type
Expand All @@ -114,7 +114,7 @@ func checkFeeParamsFromSubspace(ctx sdk.Context, didKeeper DidKeeper, resourceKe

resourceParams := resourceKeeper.GetParams(ctx)
TaxableMsgFees[MsgCreateResourceImage] = sdk.NewCoins(resourceParams.Image)
TaxableMsgFees[MsgCreateResourceJson] = sdk.NewCoins(resourceParams.Json)
TaxableMsgFees[MsgCreateResourceJSON] = sdk.NewCoins(resourceParams.Json)
TaxableMsgFees[MsgCreateResourceDefault] = sdk.NewCoins(resourceParams.Default)

BurnFactors[BurnFactorDid] = didParams.BurnFactor
Expand Down
Loading

0 comments on commit c78d712

Please sign in to comment.