diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 000000000..d51469d9b --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,62 @@ +name: Go +on: + pull_request: + paths: + - go/** + push: + branches: + - master + +permissions: + contents: read + +concurrency: + group: go-ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + # ci is set to go1.19 to match developer setups + go-version: 1.19.2 + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: v1.50.0 + working-directory: go + + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 1.19.2 + - name: test + working-directory: ./go + run: make test + + coverage: + name: Code Coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 1.19.2 + - name: Run coverage + working-directory: ./go + run: go test -race -coverprofile=coverage.txt -covermode=atomic + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + files: go/coverage.txt + fail_ci_if_error: true + diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index d5b4d46b2..d96fccc99 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -1,4 +1,4 @@ -name: "Lint PR" +name: PR on: pull_request_target: @@ -12,6 +12,7 @@ permissions: jobs: main: + name: Lint permissions: pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 77d98916c..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Lint -on: - pull_request: - push: - branches: - - master - -permissions: - contents: read - -concurrency: - group: ci-${{ github.ref }}-linting - cancel-in-progress: true - -jobs: - rust: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Check formatting of workspace - working-directory: ./rust - run: cargo fmt -- --check - - - name: Clippy linting on workspace (host-functions + std) - working-directory: ./rust - run: cargo clippy --tests -- -D warnings - - - name: Clippy linting on workspace (no-std) - working-directory: ./rust - run: cargo clippy --tests --no-default-features -- -D warnings - - - name: Clippy linting on workspace (host functions only) - working-directory: ./rust - run: cargo clippy --tests --no-default-features --features host-functions -- -D warnings - - golangci: - name: golangci-lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v3 - with: - # ci is set to go1.19 to match developer setups - go-version: 1.19.2 - - uses: actions/checkout@v3 - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.50.0 - working-directory: go - \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 000000000..7da78c78e --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,100 @@ +name: Rust +on: + pull_request: + paths: + - rust/** + push: + branches: + - master + +permissions: + contents: read + +concurrency: + group: rust-ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Check formatting + working-directory: ./rust + run: cargo fmt -- --check + + - name: Clippy (host-functions + std) + working-directory: ./rust + run: cargo clippy --tests -- -D warnings + + - name: Clippy (no-std) + working-directory: ./rust + run: cargo clippy --tests --no-default-features -- -D warnings + + - name: Clippy (host functions only) + working-directory: ./rust + run: cargo clippy --tests --no-default-features --features host-functions -- -D warnings + + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Check all target in std + working-directory: ./rust + run: cargo check --all + + - name: Check all target in no_std + working-directory: ./rust + run: cargo check --no-default-features --all + + - name: Build all targets in std + working-directory: ./rust + run: cargo build --all --all-targets + + - name: Build all targets in no_std + working-directory: ./rust + run: cargo build --all --no-default-features + + - name: Run all tests with no-std + working-directory: ./rust + run: cargo test --all --no-default-features + + - name: Run all tests with std + working-directory: ./rust + run: cargo test --all + + - name: Check no_std compatibility + run: cd rust/no-std-check/; make setup; make all + + coverage: + name: Code Coverage + runs-on: ubuntu-latest + env: + CARGO_TERM_COLOR: always + steps: + - uses: actions/checkout@v3 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Install cargo-nextest + uses: taiki-e/install-action@nextest + - name: Generate code coverage + working-directory: ./rust + run: cargo llvm-cov nextest --all-features --lcov --output-path lcov.info + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + files: rust/lcov.info + fail_ci_if_error: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index ace5bd5a5..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Tests -on: - pull_request: - push: - branches: - - master - -permissions: - contents: read - -concurrency: - group: ci-${{ github.ref }}-tests - cancel-in-progress: true - -jobs: - go: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: 1.19.2 - - name: test - working-directory: ./go - run: make test - - ts: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: test - working-directory: ./js - run: yarn && yarn test - - rust: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Check all target in std - working-directory: ./rust - run: cargo check --all - - - name: Check all target in no_std - working-directory: ./rust - run: cargo check --no-default-features --all - - - name: Build all targets in std - working-directory: ./rust - run: cargo build --all --all-targets - - - name: Build all targets in no_std - working-directory: ./rust - run: cargo build --all --no-default-features - - - name: Run all tests with no-std - working-directory: ./rust - run: cargo test --all --no-default-features - - - name: Run all tests with std - working-directory: ./rust - run: cargo test --all - - - name: check no_std compatibility - run: cd rust/no-std-check/; make setup; make all - - diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml new file mode 100644 index 000000000..9ba6516a7 --- /dev/null +++ b/.github/workflows/typescript.yml @@ -0,0 +1,24 @@ +name: TypeScript +on: + pull_request: + paths: + - js/** + push: + branches: + - master + +permissions: + contents: read + +concurrency: + group: ts-ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: test + working-directory: ./js + run: yarn && yarn test diff --git a/README.md b/README.md index 92de9ece4..1bf6131ff 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -# Proofs +[![Go](https://github.com/cosmos/ics23/actions/workflows/go.yml/badge.svg?branch=master)](https://github.com/cosmos/ics23/actions/workflows/go.yml) +[![Rust](https://github.com/cosmos/ics23/actions/workflows/rust.yml/badge.svg?branch=master)](https://github.com/cosmos/ics23/actions/workflows/rust.yml) +[![TypeScript](https://github.com/cosmos/ics23/actions/workflows/typescript.yml/badge.svg?branch=master)](https://github.com/cosmos/ics23/actions/workflows/typescript.yml) + +# ICS 23 + +## Proofs This is an attempt to define a generic, cross-language, binary representation of merkle proofs, which can be generated by many underlying merkle tree storage @@ -73,4 +79,3 @@ every step along the path in order to reconstruct the path, these are not suppor require a much more complex format and most likely custom code for each such database. The design goal was to be able to add new data sources with only configuration (spec object), rather than custom code. - diff --git a/go/Makefile b/go/Makefile index fe9755195..c0406cf73 100644 --- a/go/Makefile +++ b/go/Makefile @@ -38,4 +38,5 @@ format: @go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version) find . -name '*.go' -type f -not -name "*.pb.go" | xargs gofumpt -w -l $(golangci_lint_cmd) run --fix + .PHONY: format diff --git a/js/jasmine-testrunner.js b/js/jasmine-testrunner.js index a537da758..de9568ba9 100755 --- a/js/jasmine-testrunner.js +++ b/js/jasmine-testrunner.js @@ -13,6 +13,7 @@ jasmine.loadConfig({ seed: null, stopSpecOnExpectationFailure: false }); + jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 15*1000; // setup console reporter diff --git a/rust/README.md b/rust/README.md index 2234c2854..2b3928bbd 100644 --- a/rust/README.md +++ b/rust/README.md @@ -22,6 +22,10 @@ Unless you modify the protobuf file, you can ignore this step. `cargo clippy -- --test -W clippy::pedantic` +## Code Coverage + +`cargo llvm-cov` + ## MSRV The minimum supported Rust version (MSRV) is 1.56.1.