Skip to content

Commit

Permalink
Feat/activate validation workflow (#196)
Browse files Browse the repository at this point in the history
* (feat) Added configuration for pre-commit. Solved all issues found by pre-commit stepts, including golangci-lint

* (feat) Added GitHub workflow to run pre-commit for PRs and when pushing to master and dev

* (fix) Fix pre-commit configuration

* (fix) Fix pre-commit configuration

* (feat) Added GitHub workflow to run tests and calculate coverage

* (feat) Added Codecov badge in README.md

* (feat) Added configuration for pre-commit. Solved all issues found by pre-commit stepts, including golangci-lint

* (feat) Added GitHub workflow to run pre-commit for PRs and when pushing to master and dev

* (fix) Fix pre-commit configuration

* (fix) Fix pre-commit configuration

* (feat) Added GitHub workflow to run tests and calculate coverage

* (feat) Added Codecov badge in README.md

* (fix) Fixed incorrect numbers in example script module names

---------

Co-authored-by: abel <[email protected]>
  • Loading branch information
aarmoa and abel committed Jan 8, 2024
1 parent c618b06 commit 37f558e
Show file tree
Hide file tree
Showing 166 changed files with 902 additions and 805 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: pre-commit
on:
pull_request:
push:
branches: [master, dev]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
- uses: actions/setup-go@v5
with:
go-version: 1.19
- run: go install golang.org/x/tools/cmd/goimports@latest
- run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s - -b $(go env GOPATH)/bin v1.49.0
- run: echo "PATH=$PATH:/home/runner/go/bin" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: pre-commit/[email protected]
20 changes: 20 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: run-tests
on:
pull_request:
push:
branches: [ master, dev ]

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-go@v5
with:
go-version: 1.19
- name: Run test and calculate coverage
run: make coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.idea/
.chain_cookie
.exchange_cookie
coverage.out
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
exclude: |
(?x)^(
proto/.*|
exchange/.*
)$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
hooks:
- id: go-fmt
- id: go-imports
- id: golangci-lint
args: [--timeout=15m]
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,4 @@ Copyright © 2020 - 2022 Injective Labs Inc. (https://injectivelabs.org/)
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ copy-exchange-client:
cp -r ../injective-indexer/api/gen/grpc/injective_derivative_exchange_rpc/pb exchange/derivative_exchange_rpc/pb
cp -r ../injective-indexer/api/gen/grpc/injective_portfolio_rpc/pb exchange/portfolio_rpc/pb

.PHONY: copy-exchange-client
.PHONY: copy-exchange-client tests coverage

copy-chain-types:
cp ../injective-core/injective-chain/types/*.go chain/types
Expand Down Expand Up @@ -53,3 +53,8 @@ copy-chain-types:
echo "👉 Replace injective-core/injective-chain/modules with sdk-go/chain"
echo "👉 Replace injective-core/injective-chain/types with sdk-go/chain/types"
echo "👉 Replace injective-core/injective-chain/crypto with sdk-go/chain/crypto"

tests:
go test -race ./client/... ./ethereum/...
coverage:
go test -race -coverprofile=coverage.out -covermode=atomic ./client/... ./ethereum/...
2 changes: 1 addition & 1 deletion NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Copyright © 2020 - 2022 Injective Labs Inc. (https://injectivelabs.org/)
Originally released by Injective Labs Inc. under: <br />
Apache License <br />
Version 2.0, January 2004 <br />
http://www.apache.org/licenses/
http://www.apache.org/licenses/
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Injective Protocol Golang SDK 🌟

[![codecov](https://codecov.io/gh/InjectiveLabs/sdk-go/graph/badge.svg?token=XDGZV265EE)](https://codecov.io/gh/InjectiveLabs/sdk-go)

---

## 📚 Getting Started
Expand Down Expand Up @@ -65,4 +67,4 @@ Copyright © 2020 - 2022 Injective Labs Inc. (https://injectivelabs.org/)
Originally released by Injective Labs Inc. under: <br />
Apache License <br />
Version 2.0, January 2004 <br />
http://www.apache.org/licenses/
http://www.apache.org/licenses/
7 changes: 4 additions & 3 deletions chain/auction/types/auction.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions chain/auction/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions chain/auction/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions chain/auction/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions chain/crypto/ethsecp256k1/keys.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions chain/exchange/types/authz.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions chain/exchange/types/events.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions chain/exchange/types/exchange.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions chain/exchange/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions chain/exchange/types/proposal.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions chain/exchange/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions chain/exchange/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions chain/exchange/types/wasm_maker_contract.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package types

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"cosmossdk.io/math"
)

type MintToUser struct {
Expand All @@ -13,7 +13,7 @@ type MintToUserMsg struct {
MintToUser MintToUser `json:"mint_to_user"`
}

func NewMintToUserMsg(subaccountIDSender string, amount sdk.Int) MintToUserMsg {
func NewMintToUserMsg(subaccountIDSender string, amount math.Int) MintToUserMsg {
return MintToUserMsg{
MintToUser: MintToUser{
SubaccountIDSender: subaccountIDSender,
Expand Down
5 changes: 3 additions & 2 deletions chain/insurance/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions chain/insurance/types/insurance.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 37f558e

Please sign in to comment.