From d7677e087117fc9d79c590ee511f1f46a8cbd586 Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 19 May 2020 15:32:35 +0200 Subject: [PATCH] ci: test paths directive (#6251) * test paths directive * change proto files * test paths on code coverage * have parts of ci only run when go files are touched * add readme badge * bring back green checks * remove paths * green check linting * add tests no run --- .github/workflows/lint.yml | 13 ++- .github/workflows/proto.yml | 19 +--- .github/workflows/sims.yml | 3 +- .github/workflows/test.yml | 10 ++- README.md | 2 +- types/tx/types.proto | 174 ++++++++++++++++++------------------ 6 files changed, 115 insertions(+), 106 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b5e2c89acc..22b8faec5c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,14 +1,25 @@ name: Lint -on: [pull_request] +on: + pull_request: + push: + branches: + - master jobs: golangci: name: golangci-lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: technote-space/get-diff-action@v1 + with: + SUFFIX_FILTER: | + .go + .mod + .sum - uses: golangci/golangci-lint-action@master with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.26 args: --timeout 10m github-token: ${{ secrets.github_token }} + if: "env.GIT_DIFF != ''" diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index 403cbc4bd7..02f9f5a365 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -1,29 +1,18 @@ name: Protobuf -on: [pull_request] +on: + pull_request: + paths: + - '**.proto' jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - uses: technote-space/get-diff-action@v1 - id: git_diff - with: - SUFFIX_FILTER: .proto - SET_ENV_NAME_INSERTIONS: 1 - SET_ENV_NAME_LINES: 1 - name: lint run: make proto-lint-docker - if: "env.GIT_DIFF != ''" breakage: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - uses: technote-space/get-diff-action@v1 - id: git_diff - with: - SUFFIX_FILTER: .proto - SET_ENV_NAME_INSERTIONS: 1 - SET_ENV_NAME_LINES: 1 - name: check-breakage run: make proto-check-breaking-docker - if: "env.GIT_DIFF != ''" diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml index ea7c3e3774..c23db979a2 100644 --- a/.github/workflows/sims.yml +++ b/.github/workflows/sims.yml @@ -1,5 +1,6 @@ name: Sims -on: [pull_request] +on: + pull_request: jobs: cleanup-runs: runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 174731195a..200f474beb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,6 @@ jobs: run: | make build if: "env.GIT_DIFF != ''" - - name: test & coverage report creation run: | go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' @@ -50,10 +49,18 @@ jobs: file: ./coverage.txt # optional fail_ci_if_error: true if: "env.GIT_DIFF != ''" + integration-tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: technote-space/get-diff-action@v1 + id: git_diff + with: + SUFFIX_FILTER: | + .go + .mod + .sum - name: build-sim run: | make build-sim @@ -61,3 +68,4 @@ jobs: - name: cli-test run: | make test-integration + if: "env.GIT_DIFF != ''" diff --git a/README.md b/README.md index 734548e693..ee9948bc84 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,10 @@ parent: ![banner](docs/cosmos-sdk-image.jpg) [![version](https://img.shields.io/github/tag/cosmos/cosmos-sdk.svg)](https://github.com/cosmos/cosmos-sdk/releases/latest) -[![CircleCI](https://circleci.com/gh/cosmos/cosmos-sdk/tree/master.svg?style=shield)](https://circleci.com/gh/cosmos/cosmos-sdk/tree/master) ![Sims](https://github.com/cosmos/cosmos-sdk/workflows/Sims/badge.svg) [![codecov](https://codecov.io/gh/cosmos/cosmos-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/cosmos/cosmos-sdk) [![Go Report Card](https://goreportcard.com/badge/github.com/cosmos/cosmos-sdk)](https://goreportcard.com/report/github.com/cosmos/cosmos-sdk) +![Lint](https://github.com/cosmos/cosmos-sdk/workflows/Lint/badge.svg) [![license](https://img.shields.io/github/license/cosmos/cosmos-sdk.svg)](https://github.com/cosmos/cosmos-sdk/blob/master/LICENSE) [![LoC](https://tokei.rs/b1/github/cosmos/cosmos-sdk)](https://github.com/cosmos/cosmos-sdk) [![API Reference](https://godoc.org/github.com/cosmos/cosmos-sdk?status.svg)](https://godoc.org/github.com/cosmos/cosmos-sdk) diff --git a/types/tx/types.proto b/types/tx/types.proto index bf2bf9f2b7..4f9a468966 100644 --- a/types/tx/types.proto +++ b/types/tx/types.proto @@ -10,141 +10,141 @@ option go_package = "github.com/cosmos/cosmos-sdk/tx/types"; // Tx is the standard type used for broadcasting transactions message Tx { - // body is the processable content of the transaction - TxBody body = 1; + // body is the processable content of the transaction + TxBody body = 1; - // auth_info is the authorization related content of the transaction, specifically - // signers, signer modes and fee - AuthInfo auth_info = 2; + // auth_info is the authorization related content of the transaction, specifically + // signers, signer modes and fee + AuthInfo auth_info = 2; - // signatures are the raw binary signatures of signers specified by body and auth_info - repeated bytes signatures = 3; + // signatures are the raw binary signatures of signers specified by body and auth_info + repeated bytes signatures = 3; } // SignDoc is the standard type used for signing transaction in SIGN_MODE_DIRECT message SignDoc { - // body is the TxBody from Tx - TxBody body = 1; + // body is the TxBody from Tx + TxBody body = 1; - // auth_info is the AuthInfo from Tx - AuthInfo auth_info = 2; + // auth_info is the AuthInfo from Tx + AuthInfo auth_info = 2; - // chain_id is the unique identifier of the chain this transaction targets. - // It prevents signed transactions from being used on another chain by an - // attacker - string chain_id = 3; + // chain_id is the unique identifier of the chain this transaction targets. + // It prevents signed transactions from being used on another chain by an + // attacker + string chain_id = 3; - // account_number is the account number of the account in state - uint64 account_number = 4; + // account_number is the account number of the account in state + uint64 account_number = 4; - // account_sequence starts at 1 rather than 0 to avoid the case where - // the default 0 value must be omitted in protobuf serialization - uint64 account_sequence = 5; + // account_sequence starts at 1 rather than 0 to avoid the case where + // the default 0 value must be omitted in protobuf serialization + uint64 account_sequence = 5; } // TxBody is the body of a transaction that all signers sign over message TxBody { - // messages are the processable content of the transaction - repeated google.protobuf.Any messages = 1; + // messages are the processable content of the transaction + repeated google.protobuf.Any messages = 1; - // memo is any arbitrary memo to be added to the transaction - string memo = 2; + // memo is any arbitrary memo to be added to the transaction + string memo = 2; - // timeout is the block height after which this transaction will not - // be processed by the chain - int64 timeout_height = 3; + // timeout is the block height after which this transaction will not + // be processed by the chain + int64 timeout_height = 3; - // extension_options are arbitrary options that can be added by chains - // when the default options are not sufficient. If any of these are present - // and can't be handled, the transaction will be rejected - repeated google.protobuf.Any extension_options = 1023; + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, the transaction will be rejected + repeated google.protobuf.Any extension_options = 1023; - // extension_options are arbitrary options that can be added by chains - // when the default options are not sufficient. If any of these are present - // and can't be handled, they will be ignored - repeated google.protobuf.Any non_critical_extension_options = 2047; + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, they will be ignored + repeated google.protobuf.Any non_critical_extension_options = 2047; } // AuthInfo describes the fee and signer modes that are used to sign a transaction message AuthInfo { - // signer_infos is the list of signer infos which corresponds with - // Tx.signatures and expected signers derived from TxBody.messages. All signers - // are expected to occur in the same order in each of these locations - repeated SignerInfo signer_infos = 1; + // signer_infos is the list of signer infos which corresponds with + // Tx.signatures and expected signers derived from TxBody.messages. All signers + // are expected to occur in the same order in each of these locations + repeated SignerInfo signer_infos = 1; - // Fee is the fee and gas limit for the transaction. The first signer is the - // primary signer and the one which pays the fee - Fee fee = 2; + // Fee is the fee and gas limit for the transaction. The first signer is the + // primary signer and the one which pays the fee + Fee fee = 2; } // SignerInfo describes the public key and signing mode of a single top-level signer message SignerInfo { - // public_key is the public key of the signer. It is optional for accounts - // that already exist in state - google.protobuf.Any public_key = 1; + // public_key is the public key of the signer. It is optional for accounts + // that already exist in state + google.protobuf.Any public_key = 1; - // mode_info describes the signing mode of the signer and is a nested - // structure to support nested multisig pubkey's - ModeInfo mode_info = 2; + // mode_info describes the signing mode of the signer and is a nested + // structure to support nested multisig pubkey's + ModeInfo mode_info = 2; } // ModeInfo describes the signing mode of a single or nested multisig signer message ModeInfo { - // sum is the oneof that specifies whether this represents a single or nested - // multisig signer - oneof sum { - // single represents a single signer - Single single = 1; + // sum is the oneof that specifies whether this represents a single or nested + // multisig signer + oneof sum { + // single represents a single signer + Single single = 1; - // multi represents a nested multisig signer - Multi multi = 2; - } + // multi represents a nested multisig signer + Multi multi = 2; + } - // Single is the mode info for a single signer. It is structured as a message - // to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the future - message Single { - // mode is the signing mode of the single signer - SignMode mode = 1; - } + // Single is the mode info for a single signer. It is structured as a message + // to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the future + message Single { + // mode is the signing mode of the single signer + SignMode mode = 1; + } - // Multi is the mode info for a multisig public key - message Multi { - // bitarray specifies which keys within the multisig are signing - cosmos_sdk.crypto.v1.CompactBitArray bitarray = 1; + // Multi is the mode info for a multisig public key + message Multi { + // bitarray specifies which keys within the multisig are signing + cosmos_sdk.crypto.v1.CompactBitArray bitarray = 1; - // mode_infos is the corresponding modes of the signers of the multisig - // which could include nested multisig public keys - repeated ModeInfo mode_infos = 2; - } + // mode_infos is the corresponding modes of the signers of the multisig + // which could include nested multisig public keys + repeated ModeInfo mode_infos = 2; + } } // SignMode represents a signing mode with its own security guarantees enum SignMode { - // SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be rejected - SIGN_MODE_UNSPECIFIED = 0; + // SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be rejected + SIGN_MODE_UNSPECIFIED = 0; - // SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is verified - // with raw bytes from Tx - SIGN_MODE_DIRECT = 1; + // SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is verified + // with raw bytes from Tx + SIGN_MODE_DIRECT = 1; - // SIGN_MODE_TEXTUAL is a future signing mode that will verify some human-readable - // textual representation on top of the binary representation from SIGN_MODE_DIRECT - SIGN_MODE_TEXTUAL = 2; + // SIGN_MODE_TEXTUAL is a future signing mode that will verify some human-readable + // textual representation on top of the binary representation from SIGN_MODE_DIRECT + SIGN_MODE_TEXTUAL = 2; - // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - // Amino JSON and will be removed in the future - SIGN_MODE_LEGACY_AMINO_JSON = 127; + // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + // Amino JSON and will be removed in the future + SIGN_MODE_LEGACY_AMINO_JSON = 127; } // Fee includes the amount of coins paid in fees and the maximum // gas to be used by the transaction. The ratio yields an effective "gasprice", // which must be above some miminum to be accepted into the mempool. message Fee { - // amount is the amount of coins to be paid as a fee - repeated cosmos_sdk.v1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + // amount is the amount of coins to be paid as a fee + repeated cosmos_sdk.v1.Coin amount = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; - // gas_limit is the maximum gas that can be used in transaction processing - // before an out of gas error occurs - uint64 gas_limit = 2; + // gas_limit is the maximum gas that can be used in transaction processing + // before an out of gas error occurs + uint64 gas_limit = 2; }