From 339de11fd91408e002b4450027d8f7551592865e Mon Sep 17 00:00:00 2001 From: 170210 Date: Thu, 7 Mar 2024 15:32:23 +0900 Subject: [PATCH 1/9] ci: split tests workflow into two and refactor them Signed-off-by: 170210 --- .github/workflows/contract_tests.yml | 75 ++ .github/workflows/tests.yml | 1018 +--------------------- contracts/voting-with-uuid/.cargo/config | 4 +- 3 files changed, 84 insertions(+), 1013 deletions(-) create mode 100644 .github/workflows/contract_tests.yml diff --git a/.github/workflows/contract_tests.yml b/.github/workflows/contract_tests.yml new file mode 100644 index 000000000..d7e4abe04 --- /dev/null +++ b/.github/workflows/contract_tests.yml @@ -0,0 +1,75 @@ +name: Contract Tests + +on: + push: + branches: + - main + - 0.[0-9]+ + pull_request: + +jobs: + contract_build_and_test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + contract: [burner, crypto-verify, cyberpunk, hackatom, ibc-reflect, ibc-reflect-send, queue, query-queue, reflect, floaty, staking, voting-with-uuid, dynamic-callee-contract, dynamic-caller-contract, number, call-number, simple-callee, intermediate-number, events] + env: + working-directory: ./contracts/${{ matrix.contract }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.60.0 + target: wasm32-unknown-unknown + profile: minimal + override: true + components: rustfmt, clippy + - name: Cache cargo + uses: actions/cache@v3 + with: + path: ~/.cargo + key: cargocache-v2-${{ matrix.contract }}-rust:1.60.0-${{ hashFiles(format('contracts/{0}/Cargo.lock', matrix.contract)) }} + - name: Version information + run: rustc --version; cargo --version; rustup --version; rustup target list --installed + - name: Add wasm32 target + run: rustup target add wasm32-unknown-unknown && rustup target list --installed + - name: Build wasm binary + working-directory: ${{env.working-directory}} + run: cargo wasm --locked + - name: Unit tests + working-directory: ${{env.working-directory}} + run: cargo unit-test --locked + # + # If the contract needs other wasm file, please build currently + # + - name: Build queue wasm binary for integration tests (query-queue) + if: matrix.contract == 'query-queue' + working-directory: ./contracts/queue + run: cargo wasm --locked + # + # Finish + # + - name: Integration tests (singlepass backend) + working-directory: ${{env.working-directory}} + run: cargo integration-test --locked --no-default-features + - name: Build and run schema generator + working-directory: ${{env.working-directory}} + run: cargo schema --locked + - name: Ensure schemas are up-to-date + working-directory: ${{env.working-directory}} + run: | + CHANGES_IN_REPO=$(git status --porcelain) + if [[ -n "$CHANGES_IN_REPO" ]]; then + echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" + git status && git --no-pager diff + exit 1 + fi + - name: Check formatting + working-directory: ${{env.working-directory}} + run: cargo fmt -- --check + - name: Clippy linting on burner + working-directory: ${{env.working-directory}} + run: cargo clippy --tests -- -D warnings diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 85c38b6ac..9b8828887 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -216,821 +216,15 @@ jobs: working-directory: ${{env.working-directory}} run: cargo test --locked --features iterator,staking,stargate - contract_burner: - name: contract_burner + clippy-and-fmt: + name: clippy-and-fmt runs-on: ubuntu-latest env: - working-directory: ./contracts/burner - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargocache-v2-contract_burner-rust:1.60.0-${{ hashFiles('contracts/burner/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_crypto_verify: - name: contract_crypto_verify - runs-on: ubuntu-latest - env: - working-directory: ./contracts/crypto-verify - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargocache-v2-contract_crypto_verify-rust:1.60.0-${{ hashFiles('contracts/crypto-verify/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_hackatom: - name: contract_hackatom - runs-on: ubuntu-latest - env: - working-directory: ./contracts/hackatom - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargocache-v2-contract_hackatom-rust:1.60.0-${{ hashFiles('contracts/hackatom/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_ibc_reflect: - name: contract_ibc_reflect - runs-on: ubuntu-latest - env: - working-directory: ./contracts/ibc-reflect - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargocache-v2-contract_ibc_reflect-rust:1.60.0-${{ hashFiles('contracts/ibc-reflect/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_ibc_reflect_send: - name: contract_ibc_reflect_send - runs-on: ubuntu-latest - env: - working-directory: ./contracts/ibc-reflect-send - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargocache-v2-contract_ibc_reflect_send-rust:1.60.0-${{ hashFiles('contracts/ibc-reflect-send/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_queue: - name: contract_queue - runs-on: ubuntu-latest - env: - working-directory: ./contracts/queue - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargocache-v2-contract_queue-rust:1.60.0-${{ hashFiles('contracts/queue/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_query_queue: - name: contract_query_queue - runs-on: ubuntu-latest - env: - working-directory: ./contracts/query-queue - queue-directory: ./contracts/queue - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargocache-v2-contract_query_queue-rust:1.60.0-${{ hashFiles('contracts/queue/Cargo.lock', 'contracts/query-queue/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Build queue wasm binary for integration tests - working-directory: ${{env.queue-directory}} - run: cargo wasm --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_reflect: - name: contract_reflect - runs-on: ubuntu-latest - env: - working-directory: ./contracts/reflect - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargocache-v2-contract_reflect-rust:1.60.0-${{ hashFiles('contracts/reflect/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_staking: - name: contract_staking - runs-on: ubuntu-latest - env: - working-directory: ./contracts/staking - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargocache-v2-contract_staking-rust:1.60.0-${{ hashFiles('contracts/staking/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_voting_with_uuid: - name: contract_voting_with_uuid - runs-on: ubuntu-latest - env: - working-directory: ./contracts/voting-with-uuid - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargocache-v2-contract_staking-rust:1.60.0-${{ hashFiles('contracts/voting-with-uuid/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test-for-ci --locked --no-default-features - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_dynamic_callee_contract: - name: dynamic_callee_contract - runs-on: ubuntu-latest - env: - working-directory: ./contracts/dynamic-callee-contract - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v2 - with: - path: ~/.cargo - key: cargocache-v2-contract_dynamic_callee_contract-rust:1.60.0-${{ hashFiles('contracts/dynamic-callee-contract/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Documentation tests - working-directory: ${{env.working-directory}} - run: cargo doc-test --locked - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_dynamic_caller_contract: - name: dynamic_caller_contract - runs-on: ubuntu-latest - env: - working-directory: ./contracts/dynamic-caller-contract - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v2 - with: - path: ~/.cargo - key: cargocache-v2-contract_dynamic_caller_contract-rust:1.60.0-${{ hashFiles('contracts/dynamic-caller-contract/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Documentation tests - working-directory: ${{env.working-directory}} - run: cargo doc-test --locked - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_number: - name: contract_number - runs-on: ubuntu-latest - env: - working-directory: ./contracts/number - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v2 - with: - path: ~/.cargo - key: cargocache-v2-contract_number-rust:1.60.0-${{ hashFiles('contracts/number/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Documentation tests - working-directory: ${{env.working-directory}} - run: cargo doc-test --locked - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_call_number: - name: contract_call_number - runs-on: ubuntu-latest - env: - working-directory: ./contracts/call-number - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v2 - with: - path: ~/.cargo - key: cargocache-v2-contract_call_number-rust:1.60.0-${{ hashFiles('contracts/call-number/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Documentation tests - working-directory: ${{env.working-directory}} - run: cargo doc-test - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_simple_callee: - name: contract_simple_callee - runs-on: ubuntu-latest - env: - working-directory: ./contracts/simple-callee - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v2 - with: - path: ~/.cargo - key: cargocache-v2-contract_simple_callee-rust:1.60.0-${{ hashFiles('contracts/simple-callee/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Documentation tests - working-directory: ${{env.working-directory}} - run: cargo doc-test --locked - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_intermediate_number: - name: contract_intermediate_number - runs-on: ubuntu-latest - env: - working-directory: ./contracts/intermediate-number - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v2 - with: - path: ~/.cargo - key: cargocache-v2-contract_intermediate_number-rust:1.60.0-${{ hashFiles('contracts/intermediate-number/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Documentation tests - working-directory: ${{env.working-directory}} - run: cargo doc-test --locked - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_events: - name: contract_events - runs-on: ubuntu-latest - env: - working-directory: ./contracts/events - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v2 - with: - path: ~/.cargo - key: cargocache-v2-contract_events-rust:1.60.0-${{ hashFiles('contracts/events/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: cargo unit-test --locked - - name: Integration tests (singlepass backend) - working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features - - name: Documentation tests - working-directory: ${{env.working-directory}} - run: cargo doc-test --locked - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - fmt: - name: fmt - runs-on: ubuntu-latest - env: - root-directory: ./contracts + packages: ./packages + contracts: ./contracts steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install Rust uses: actions-rs/toolchain@v1 with: @@ -1038,6 +232,7 @@ jobs: target: wasm32-unknown-unknown profile: minimal override: true + components: rustfmt, clippy - name: Cache cargo uses: actions/cache@v3 with: @@ -1045,92 +240,10 @@ jobs: key: cargocache-v2-fmt-rust:1.60.0-${{ hashFiles('Cargo.lock', 'contracts/*/Cargo.lock') }} - name: Version information run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add rustfmt component - run: rustup component add rustfmt - name: Check formatting of workspace run: cargo fmt -- --check - - name: Check formatting of contract burner - working-directory: ${{env.root-directory}}/burner - run: cargo fmt -- --check - - name: Check formatting of contract crypto-verify - working-directory: ${{env.root-directory}}/crypto-verify - run: cargo fmt -- --check - - name: Check formatting of contract hackatom - working-directory: ${{env.root-directory}}/hackatom - run: cargo fmt -- --check - - name: Check formatting of contract reflect - working-directory: ${{env.root-directory}}/reflect - run: cargo fmt -- --check - - name: Check formatting of contract queue - working-directory: ${{env.root-directory}}/queue - run: cargo fmt -- --check - - name: Check formatting of contract query-queue - working-directory: ${{env.root-directory}}/query-queue - run: cargo fmt -- --check - - name: Check formatting of contract staking - working-directory: ${{env.root-directory}}/staking - run: cargo fmt -- --check - - name: Check formatting of contract floaty - working-directory: ${{env.root-directory}}/floaty - run: cargo fmt -- --check - - name: Check formatting of contract dynamic callee contract - working-directory: ${{env.root-directory}}/dynamic-callee-contract - run: cargo fmt -- --check - - name: Check formatting of contract dynamic caller contract - working-directory: ${{env.root-directory}}/dynamic-caller-contract - run: cargo fmt -- --check - - name: Check formatting of contract number - working-directory: ${{env.root-directory}}/number - run: cargo fmt -- --check - - name: Check formatting of contract intermediate-number - working-directory: ${{env.root-directory}}/intermediate-number - run: cargo fmt -- --check - - name: Check formatting of contract call number - working-directory: ${{env.root-directory}}/call-number - run: cargo fmt -- --check - - name: Check formatting of contract events - working-directory: ${{env.root-directory}}/events - run: cargo fmt -- --check - - name: Check formatting of contract voting with uuid - working-directory: ${{env.root-directory}}/voting-with-uuid - run: cargo fmt -- --check - - name: Check formatting of contract ibc reflect - working-directory: ${{env.root-directory}}/ibc-reflect - run: cargo fmt -- --check - - name: Check formatting of contract ibc reflect send - working-directory: ${{env.root-directory}}/ibc-reflect-send - run: cargo fmt -- --check - - name: Check formatting of contract simple callee - working-directory: ${{env.root-directory}}/simple-callee - run: cargo fmt -- --check - - clippy: - name: clippy - runs-on: ubuntu-latest - env: - packages: ./packages - contracts: ./contracts - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargocache-v2-clippy-rust:1.60.0-${{ hashFiles('Cargo.lock', 'contracts/*/Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add clippy component - run: rustup component add clippy # - # Workspace packages + # Check clippy linting on Workspace packages # - name: Clippy linting on schema working-directory: ${{env.packages}}/schema @@ -1153,120 +266,3 @@ jobs: - name: Clippy linting on vm (all feature flags) working-directory: ${{env.packages}}/vm run: cargo clippy --features iterator,staking,stargate -- -D warnings - # - # Contracts - # - - name: Clippy linting on burner - working-directory: ${{env.contracts}}/burner - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/burner.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on crypto-verify - working-directory: ${{env.contracts}}/crypto-verify - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/crypto_verify.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on hackatom - working-directory: ${{env.contracts}}/hackatom - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/hackatom.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on ibc-reflect - working-directory: ${{env.contracts}}/ibc-reflect - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/ibc_reflect.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on ibc-reflect-send - working-directory: ${{env.contracts}}/ibc-reflect-send - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/ibc_reflect_send.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on queue - working-directory: ${{env.contracts}}/queue - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/queue.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on query-queue - working-directory: ${{env.contracts}}/query-queue - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/query_queue.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on reflect - working-directory: ${{env.contracts}}/reflect - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/reflect.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on staking - working-directory: ${{env.contracts}}/staking - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/staking.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on dynamic-callee-contract - working-directory: ${{env.contracts}}/dynamic-callee-contract - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/dynamic_callee_contract.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on dynamic-caller-contract - working-directory: ${{env.contracts}}/dynamic-caller-contract - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/dynamic_caller_contract.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on number - working-directory: ${{env.contracts}}/number - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/number.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on intermediate-number - working-directory: ${{env.contracts}}/intermediate-number - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/intermediate_number.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on call-number - working-directory: ${{env.contracts}}/call-number - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/call_number.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on cyberpunk - working-directory: ${{env.contracts}}/cyberpunk - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/cyberpunk.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on events - working-directory: ${{env.contracts}}/events - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/events.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on floaty - working-directory: ${{env.contracts}}/floaty - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/floaty.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on simple-callee - working-directory: ${{env.contracts}}/simple-callee - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/simple_callee.wasm - cargo clippy --tests -- -D warnings - - name: Clippy linting on voting-with-uuid - working-directory: ${{env.contracts}}/voting-with-uuid - run: | - mkdir -p target/wasm32-unknown-unknown/release - touch target/wasm32-unknown-unknown/release/cw_voting_with_uuid.wasm - cargo clippy --tests -- -D warnings diff --git a/contracts/voting-with-uuid/.cargo/config b/contracts/voting-with-uuid/.cargo/config index 9a1df2e20..4e5f323c5 100644 --- a/contracts/voting-with-uuid/.cargo/config +++ b/contracts/voting-with-uuid/.cargo/config @@ -2,6 +2,6 @@ wasm = "build --release --target wasm32-unknown-unknown" wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" -integration-test = "test --test integration -- --color always --nocapture" -integration-test-for-ci = "test --test integration" +integration-test-for-debug = "test --test integration -- --color always --nocapture" +integration-test = "test --test integration" schema = "run --example schema" From 851f8066b2123cebc7ad7feac953da52dbf5d10b Mon Sep 17 00:00:00 2001 From: 170210 Date: Thu, 7 Mar 2024 17:26:30 +0900 Subject: [PATCH 2/9] ci: add document test for each contract Signed-off-by: 170210 --- .github/workflows/contract_tests.yml | 3 +++ contracts/burner/.cargo/config | 1 + contracts/crypto-verify/.cargo/config | 1 + contracts/cyberpunk/.cargo/config | 1 + contracts/floaty/.cargo/config | 1 + contracts/hackatom/.cargo/config | 1 + contracts/ibc-reflect-send/.cargo/config | 1 + contracts/ibc-reflect/.cargo/config | 1 + contracts/query-queue/.cargo/config | 1 + contracts/queue/.cargo/config | 1 + contracts/reflect/.cargo/config | 1 + contracts/staking/.cargo/config | 1 + contracts/voting-with-uuid/.cargo/config | 1 + 13 files changed, 15 insertions(+) diff --git a/.github/workflows/contract_tests.yml b/.github/workflows/contract_tests.yml index d7e4abe04..6b65ee410 100644 --- a/.github/workflows/contract_tests.yml +++ b/.github/workflows/contract_tests.yml @@ -55,6 +55,9 @@ jobs: - name: Integration tests (singlepass backend) working-directory: ${{env.working-directory}} run: cargo integration-test --locked --no-default-features + - name: Documentation tests + working-directory: ${{env.working-directory}} + run: cargo doc-test --locked - name: Build and run schema generator working-directory: ${{env.working-directory}} run: cargo schema --locked diff --git a/contracts/burner/.cargo/config b/contracts/burner/.cargo/config index 8d4bc738b..045e8c9af 100644 --- a/contracts/burner/.cargo/config +++ b/contracts/burner/.cargo/config @@ -4,3 +4,4 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" diff --git a/contracts/crypto-verify/.cargo/config b/contracts/crypto-verify/.cargo/config index 8d4bc738b..045e8c9af 100644 --- a/contracts/crypto-verify/.cargo/config +++ b/contracts/crypto-verify/.cargo/config @@ -4,3 +4,4 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" diff --git a/contracts/cyberpunk/.cargo/config b/contracts/cyberpunk/.cargo/config index 8d4bc738b..045e8c9af 100644 --- a/contracts/cyberpunk/.cargo/config +++ b/contracts/cyberpunk/.cargo/config @@ -4,3 +4,4 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" diff --git a/contracts/floaty/.cargo/config b/contracts/floaty/.cargo/config index 8d4bc738b..045e8c9af 100644 --- a/contracts/floaty/.cargo/config +++ b/contracts/floaty/.cargo/config @@ -4,3 +4,4 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" diff --git a/contracts/hackatom/.cargo/config b/contracts/hackatom/.cargo/config index 8d4bc738b..045e8c9af 100644 --- a/contracts/hackatom/.cargo/config +++ b/contracts/hackatom/.cargo/config @@ -4,3 +4,4 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" diff --git a/contracts/ibc-reflect-send/.cargo/config b/contracts/ibc-reflect-send/.cargo/config index 8d4bc738b..045e8c9af 100644 --- a/contracts/ibc-reflect-send/.cargo/config +++ b/contracts/ibc-reflect-send/.cargo/config @@ -4,3 +4,4 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" diff --git a/contracts/ibc-reflect/.cargo/config b/contracts/ibc-reflect/.cargo/config index 8d4bc738b..045e8c9af 100644 --- a/contracts/ibc-reflect/.cargo/config +++ b/contracts/ibc-reflect/.cargo/config @@ -4,3 +4,4 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" diff --git a/contracts/query-queue/.cargo/config b/contracts/query-queue/.cargo/config index 8d4bc738b..045e8c9af 100644 --- a/contracts/query-queue/.cargo/config +++ b/contracts/query-queue/.cargo/config @@ -4,3 +4,4 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" diff --git a/contracts/queue/.cargo/config b/contracts/queue/.cargo/config index 8d4bc738b..045e8c9af 100644 --- a/contracts/queue/.cargo/config +++ b/contracts/queue/.cargo/config @@ -4,3 +4,4 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" diff --git a/contracts/reflect/.cargo/config b/contracts/reflect/.cargo/config index 8d4bc738b..045e8c9af 100644 --- a/contracts/reflect/.cargo/config +++ b/contracts/reflect/.cargo/config @@ -4,3 +4,4 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" diff --git a/contracts/staking/.cargo/config b/contracts/staking/.cargo/config index 8d4bc738b..045e8c9af 100644 --- a/contracts/staking/.cargo/config +++ b/contracts/staking/.cargo/config @@ -4,3 +4,4 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" diff --git a/contracts/voting-with-uuid/.cargo/config b/contracts/voting-with-uuid/.cargo/config index 4e5f323c5..ee596ba87 100644 --- a/contracts/voting-with-uuid/.cargo/config +++ b/contracts/voting-with-uuid/.cargo/config @@ -5,3 +5,4 @@ unit-test = "test --lib" integration-test-for-debug = "test --test integration -- --color always --nocapture" integration-test = "test --test integration" schema = "run --example schema" +doc-test = "test --doc" From 620825b9505ee5ce1d94899223aafd13f5b1a2f9 Mon Sep 17 00:00:00 2001 From: 170210 Date: Thu, 7 Mar 2024 17:27:05 +0900 Subject: [PATCH 3/9] ci: update cache action version Signed-off-by: 170210 --- .github/workflows/contract_tests.yml | 2 +- .github/workflows/tests.yml | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/contract_tests.yml b/.github/workflows/contract_tests.yml index 6b65ee410..17d09198f 100644 --- a/.github/workflows/contract_tests.yml +++ b/.github/workflows/contract_tests.yml @@ -28,7 +28,7 @@ jobs: override: true components: rustfmt, clippy - name: Cache cargo - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cargo key: cargocache-v2-${{ matrix.contract }}-rust:1.60.0-${{ hashFiles(format('contracts/{0}/Cargo.lock', matrix.contract)) }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9b8828887..c87256ccd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,7 @@ jobs: profile: minimal override: true - name: Cache cargo - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cargo key: cargocache-v2-package_crypto-rust:1.60.0-${{ hashFiles('Cargo.lock') }} @@ -53,7 +53,7 @@ jobs: profile: minimal override: true - name: Cache cargo - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cargo key: cargocache-v2-package_derive-rust:1.60.0-${{ hashFiles('Cargo.lock') }} @@ -82,7 +82,7 @@ jobs: profile: minimal override: true - name: Cache cargo - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cargo key: cargocache-v2-package_schema-rust:1.60.0-${{ hashFiles('Cargo.lock') }} @@ -111,7 +111,7 @@ jobs: profile: minimal override: true - name: Cache cargo - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cargo key: cargocache-v2-package_std-rust:1.60.0-${{ hashFiles('Cargo.lock') }} @@ -165,7 +165,7 @@ jobs: profile: minimal override: true - name: Cache cargo - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cargo key: cargocache-v2-package_storage-rust:1.60.0-${{ hashFiles('Cargo.lock') }} @@ -197,7 +197,7 @@ jobs: profile: minimal override: true - name: Cache cargo - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cargo key: cargocache-v2-package_vm-rust:1.60.0-${{ hashFiles('Cargo.lock') }} @@ -234,7 +234,7 @@ jobs: override: true components: rustfmt, clippy - name: Cache cargo - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cargo key: cargocache-v2-fmt-rust:1.60.0-${{ hashFiles('Cargo.lock', 'contracts/*/Cargo.lock') }} From d8b17b9f574dc77df41a3343c01c196bfdf7732b Mon Sep 17 00:00:00 2001 From: 170210 Date: Thu, 7 Mar 2024 18:07:18 +0900 Subject: [PATCH 4/9] chore: typo error Signed-off-by: 170210 --- .github/workflows/contract_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contract_tests.yml b/.github/workflows/contract_tests.yml index 17d09198f..62fd75ebb 100644 --- a/.github/workflows/contract_tests.yml +++ b/.github/workflows/contract_tests.yml @@ -43,7 +43,7 @@ jobs: working-directory: ${{env.working-directory}} run: cargo unit-test --locked # - # If the contract needs other wasm file, please build currently + # If this contract requires other contracts for integration testing, please compile it here # - name: Build queue wasm binary for integration tests (query-queue) if: matrix.contract == 'query-queue' From c46efb78209e0b38e596e017ce7be9c9993ec5e5 Mon Sep 17 00:00:00 2001 From: 170210 Date: Thu, 7 Mar 2024 18:15:26 +0900 Subject: [PATCH 5/9] ci: use test --doc instead of doc-test config Signed-off-by: 170210 --- .github/workflows/contract_tests.yml | 2 +- contracts/burner/.cargo/config | 1 - contracts/call-number/.cargo/config | 1 - contracts/crypto-verify/.cargo/config | 1 - contracts/cyberpunk/.cargo/config | 1 - contracts/dynamic-callee-contract/.cargo/config | 1 - contracts/dynamic-caller-contract/.cargo/config | 1 - contracts/events/.cargo/config | 1 - contracts/floaty/.cargo/config | 1 - contracts/hackatom/.cargo/config | 1 - contracts/ibc-reflect-send/.cargo/config | 1 - contracts/ibc-reflect/.cargo/config | 1 - contracts/intermediate-number/.cargo/config | 1 - contracts/number/.cargo/config | 1 - contracts/query-queue/.cargo/config | 1 - contracts/queue/.cargo/config | 1 - contracts/reflect/.cargo/config | 1 - contracts/simple-callee/.cargo/config | 1 - contracts/staking/.cargo/config | 1 - contracts/voting-with-uuid/.cargo/config | 1 - 20 files changed, 1 insertion(+), 20 deletions(-) diff --git a/.github/workflows/contract_tests.yml b/.github/workflows/contract_tests.yml index 62fd75ebb..2d726b338 100644 --- a/.github/workflows/contract_tests.yml +++ b/.github/workflows/contract_tests.yml @@ -57,7 +57,7 @@ jobs: run: cargo integration-test --locked --no-default-features - name: Documentation tests working-directory: ${{env.working-directory}} - run: cargo doc-test --locked + run: cargo test --doc --locked - name: Build and run schema generator working-directory: ${{env.working-directory}} run: cargo schema --locked diff --git a/contracts/burner/.cargo/config b/contracts/burner/.cargo/config index 045e8c9af..8d4bc738b 100644 --- a/contracts/burner/.cargo/config +++ b/contracts/burner/.cargo/config @@ -4,4 +4,3 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" diff --git a/contracts/call-number/.cargo/config b/contracts/call-number/.cargo/config index e7be8b2ae..4e9fd307d 100644 --- a/contracts/call-number/.cargo/config +++ b/contracts/call-number/.cargo/config @@ -3,4 +3,3 @@ wasm = "build --release --target wasm32-unknown-unknown" unit-test = "test --lib" schema = "run --example schema" integration-test = "test --test integration" -doc-test = "test --doc" diff --git a/contracts/crypto-verify/.cargo/config b/contracts/crypto-verify/.cargo/config index 045e8c9af..8d4bc738b 100644 --- a/contracts/crypto-verify/.cargo/config +++ b/contracts/crypto-verify/.cargo/config @@ -4,4 +4,3 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" diff --git a/contracts/cyberpunk/.cargo/config b/contracts/cyberpunk/.cargo/config index 045e8c9af..8d4bc738b 100644 --- a/contracts/cyberpunk/.cargo/config +++ b/contracts/cyberpunk/.cargo/config @@ -4,4 +4,3 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" diff --git a/contracts/dynamic-callee-contract/.cargo/config b/contracts/dynamic-callee-contract/.cargo/config index e7be8b2ae..4e9fd307d 100644 --- a/contracts/dynamic-callee-contract/.cargo/config +++ b/contracts/dynamic-callee-contract/.cargo/config @@ -3,4 +3,3 @@ wasm = "build --release --target wasm32-unknown-unknown" unit-test = "test --lib" schema = "run --example schema" integration-test = "test --test integration" -doc-test = "test --doc" diff --git a/contracts/dynamic-caller-contract/.cargo/config b/contracts/dynamic-caller-contract/.cargo/config index e7be8b2ae..4e9fd307d 100644 --- a/contracts/dynamic-caller-contract/.cargo/config +++ b/contracts/dynamic-caller-contract/.cargo/config @@ -3,4 +3,3 @@ wasm = "build --release --target wasm32-unknown-unknown" unit-test = "test --lib" schema = "run --example schema" integration-test = "test --test integration" -doc-test = "test --doc" diff --git a/contracts/events/.cargo/config b/contracts/events/.cargo/config index e7be8b2ae..4e9fd307d 100644 --- a/contracts/events/.cargo/config +++ b/contracts/events/.cargo/config @@ -3,4 +3,3 @@ wasm = "build --release --target wasm32-unknown-unknown" unit-test = "test --lib" schema = "run --example schema" integration-test = "test --test integration" -doc-test = "test --doc" diff --git a/contracts/floaty/.cargo/config b/contracts/floaty/.cargo/config index 045e8c9af..8d4bc738b 100644 --- a/contracts/floaty/.cargo/config +++ b/contracts/floaty/.cargo/config @@ -4,4 +4,3 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" diff --git a/contracts/hackatom/.cargo/config b/contracts/hackatom/.cargo/config index 045e8c9af..8d4bc738b 100644 --- a/contracts/hackatom/.cargo/config +++ b/contracts/hackatom/.cargo/config @@ -4,4 +4,3 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" diff --git a/contracts/ibc-reflect-send/.cargo/config b/contracts/ibc-reflect-send/.cargo/config index 045e8c9af..8d4bc738b 100644 --- a/contracts/ibc-reflect-send/.cargo/config +++ b/contracts/ibc-reflect-send/.cargo/config @@ -4,4 +4,3 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" diff --git a/contracts/ibc-reflect/.cargo/config b/contracts/ibc-reflect/.cargo/config index 045e8c9af..8d4bc738b 100644 --- a/contracts/ibc-reflect/.cargo/config +++ b/contracts/ibc-reflect/.cargo/config @@ -4,4 +4,3 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" diff --git a/contracts/intermediate-number/.cargo/config b/contracts/intermediate-number/.cargo/config index e7be8b2ae..4e9fd307d 100644 --- a/contracts/intermediate-number/.cargo/config +++ b/contracts/intermediate-number/.cargo/config @@ -3,4 +3,3 @@ wasm = "build --release --target wasm32-unknown-unknown" unit-test = "test --lib" schema = "run --example schema" integration-test = "test --test integration" -doc-test = "test --doc" diff --git a/contracts/number/.cargo/config b/contracts/number/.cargo/config index e7be8b2ae..4e9fd307d 100644 --- a/contracts/number/.cargo/config +++ b/contracts/number/.cargo/config @@ -3,4 +3,3 @@ wasm = "build --release --target wasm32-unknown-unknown" unit-test = "test --lib" schema = "run --example schema" integration-test = "test --test integration" -doc-test = "test --doc" diff --git a/contracts/query-queue/.cargo/config b/contracts/query-queue/.cargo/config index 045e8c9af..8d4bc738b 100644 --- a/contracts/query-queue/.cargo/config +++ b/contracts/query-queue/.cargo/config @@ -4,4 +4,3 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" diff --git a/contracts/queue/.cargo/config b/contracts/queue/.cargo/config index 045e8c9af..8d4bc738b 100644 --- a/contracts/queue/.cargo/config +++ b/contracts/queue/.cargo/config @@ -4,4 +4,3 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" diff --git a/contracts/reflect/.cargo/config b/contracts/reflect/.cargo/config index 045e8c9af..8d4bc738b 100644 --- a/contracts/reflect/.cargo/config +++ b/contracts/reflect/.cargo/config @@ -4,4 +4,3 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" diff --git a/contracts/simple-callee/.cargo/config b/contracts/simple-callee/.cargo/config index e7be8b2ae..4e9fd307d 100644 --- a/contracts/simple-callee/.cargo/config +++ b/contracts/simple-callee/.cargo/config @@ -3,4 +3,3 @@ wasm = "build --release --target wasm32-unknown-unknown" unit-test = "test --lib" schema = "run --example schema" integration-test = "test --test integration" -doc-test = "test --doc" diff --git a/contracts/staking/.cargo/config b/contracts/staking/.cargo/config index 045e8c9af..8d4bc738b 100644 --- a/contracts/staking/.cargo/config +++ b/contracts/staking/.cargo/config @@ -4,4 +4,3 @@ wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" diff --git a/contracts/voting-with-uuid/.cargo/config b/contracts/voting-with-uuid/.cargo/config index ee596ba87..4e5f323c5 100644 --- a/contracts/voting-with-uuid/.cargo/config +++ b/contracts/voting-with-uuid/.cargo/config @@ -5,4 +5,3 @@ unit-test = "test --lib" integration-test-for-debug = "test --test integration -- --color always --nocapture" integration-test = "test --test integration" schema = "run --example schema" -doc-test = "test --doc" From 996eb42620361bbf3c9ca02ae36454d681dd56e5 Mon Sep 17 00:00:00 2001 From: 170210 Date: Thu, 7 Mar 2024 18:18:16 +0900 Subject: [PATCH 6/9] ci: use cargo test --test integration instead of config Signed-off-by: 170210 --- .github/workflows/contract_tests.yml | 2 +- contracts/voting-with-uuid/.cargo/config | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/contract_tests.yml b/.github/workflows/contract_tests.yml index 2d726b338..7ba3078c2 100644 --- a/.github/workflows/contract_tests.yml +++ b/.github/workflows/contract_tests.yml @@ -54,7 +54,7 @@ jobs: # - name: Integration tests (singlepass backend) working-directory: ${{env.working-directory}} - run: cargo integration-test --locked --no-default-features + run: cargo test --test integration --locked --no-default-features - name: Documentation tests working-directory: ${{env.working-directory}} run: cargo test --doc --locked diff --git a/contracts/voting-with-uuid/.cargo/config b/contracts/voting-with-uuid/.cargo/config index 4e5f323c5..9a1df2e20 100644 --- a/contracts/voting-with-uuid/.cargo/config +++ b/contracts/voting-with-uuid/.cargo/config @@ -2,6 +2,6 @@ wasm = "build --release --target wasm32-unknown-unknown" wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" -integration-test-for-debug = "test --test integration -- --color always --nocapture" -integration-test = "test --test integration" +integration-test = "test --test integration -- --color always --nocapture" +integration-test-for-ci = "test --test integration" schema = "run --example schema" From c30d28a865045f3ebd211d695142a6d00f06b599 Mon Sep 17 00:00:00 2001 From: 170210 Date: Thu, 7 Mar 2024 18:27:48 +0900 Subject: [PATCH 7/9] chore: typo error (fix for comment) Signed-off-by: 170210 --- .github/workflows/contract_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contract_tests.yml b/.github/workflows/contract_tests.yml index 7ba3078c2..790e76d25 100644 --- a/.github/workflows/contract_tests.yml +++ b/.github/workflows/contract_tests.yml @@ -73,6 +73,6 @@ jobs: - name: Check formatting working-directory: ${{env.working-directory}} run: cargo fmt -- --check - - name: Clippy linting on burner + - name: Clippy linting working-directory: ${{env.working-directory}} run: cargo clippy --tests -- -D warnings From 6c3176a1a08bfafe1e5a01537a502929cc5a1b6a Mon Sep 17 00:00:00 2001 From: 170210 Date: Fri, 8 Mar 2024 13:12:29 +0900 Subject: [PATCH 8/9] chore: delete unnecessary env parameter Signed-off-by: 170210 --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c87256ccd..4279562cc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -221,7 +221,6 @@ jobs: runs-on: ubuntu-latest env: packages: ./packages - contracts: ./contracts steps: - name: Checkout uses: actions/checkout@v4 From b8684ece87e09f9718915f3e6752ab83a0bc6d2c Mon Sep 17 00:00:00 2001 From: 170210 Date: Mon, 11 Mar 2024 17:56:49 +0900 Subject: [PATCH 9/9] fixup: fix for comment Signed-off-by: 170210 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4279562cc..474b119ba 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -236,7 +236,7 @@ jobs: uses: actions/cache@v4 with: path: ~/.cargo - key: cargocache-v2-fmt-rust:1.60.0-${{ hashFiles('Cargo.lock', 'contracts/*/Cargo.lock') }} + key: cargocache-v2-fmt-rust:1.60.0-${{ hashFiles('Cargo.lock') }} - name: Version information run: rustc --version; cargo --version; rustup --version; rustup target list --installed - name: Check formatting of workspace