From 158702ccaff40e1532dc5b4d872bdf3232d34c16 Mon Sep 17 00:00:00 2001 From: STerliakov Date: Mon, 28 Apr 2025 05:18:31 +0200 Subject: [PATCH 1/4] Separate pre-commit, tests and on-chain --- .github/workflows/build.yml | 45 +++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 880c74b..8f13691 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ permissions: jobs: build: - name: Build with rust ${{matrix.rust}} on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}} + name: Test with rust ${{matrix.rust}} on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}} runs-on: ${{matrix.os}}-latest strategy: fail-fast: false @@ -37,16 +37,16 @@ jobs: # The node doesn't seem to enjoy us sending a lot of requests concurrently. run: cargo test --all-features -- --test-threads=1 - test: - name: Test + lint: + name: Lint runs-on: ubuntu-latest - timeout-minutes: 30 steps: - uses: actions/checkout@v4 with: persist-credentials: false - uses: actions/setup-python@v5 + - name: Install nightly toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: @@ -62,19 +62,46 @@ jobs: tool: cargo-tarpaulin,cargo-rdme - name: Check README is up-to-date - run: cargo +nightly rdme --check + run: cargo rdme --check - - name: Run tests with coverage - run: RUST_BACKTRACE=1 cargo +nightly tarpaulin --out Xml --all-features --doc --tests + test-onchain: + name: Run chain-mosifying examples + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install nightly toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable - name: Submit several transactions to chain run: | - RUST_BACKTRACE=1 cargo +nightly run --example transaction_broadcast --all-features - RUST_BACKTRACE=1 cargo +nightly run --example contract_interaction --all-features + RUST_BACKTRACE=1 cargo run --example transaction_broadcast --all-features + RUST_BACKTRACE=1 cargo run --example contract_interaction --all-features env: TEST_TO_ADDRESS: ${{ secrets.TO_ADDRESS }} TEST_MNEMONIC: ${{ secrets.MNEMONIC }} + coverage: + name: Coverage + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install nightly toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly + + - name: Run tests with coverage + run: RUST_BACKTRACE=1 cargo +nightly tarpaulin --out Xml --all-features --doc --tests + - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 env: From 0712abb5837f9f3f065e6afc416d0004b968ae30 Mon Sep 17 00:00:00 2001 From: STerliakov Date: Mon, 28 Apr 2025 05:22:03 +0200 Subject: [PATCH 2/4] Move tool install --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f13691..2959f97 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,7 +59,7 @@ jobs: - uses: taiki-e/install-action@v2 # zizmor: ignore[ref-confusion] with: - tool: cargo-tarpaulin,cargo-rdme + tool: cargo-rdme - name: Check README is up-to-date run: cargo rdme --check @@ -99,6 +99,10 @@ jobs: with: toolchain: nightly + - uses: taiki-e/install-action@v2 # zizmor: ignore[ref-confusion] + with: + tool: cargo-tarpaulin + - name: Run tests with coverage run: RUST_BACKTRACE=1 cargo +nightly tarpaulin --out Xml --all-features --doc --tests From 0abc979695ff31f509b3885e901e58f12837d2b6 Mon Sep 17 00:00:00 2001 From: STerliakov Date: Mon, 28 Apr 2025 05:41:40 +0200 Subject: [PATCH 3/4] Do not run onchain tests until everything else is green --- .github/workflows/build.yml | 43 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2959f97..f479123 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,27 +64,6 @@ jobs: - name: Check README is up-to-date run: cargo rdme --check - test-onchain: - name: Run chain-mosifying examples - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install nightly toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: stable - - - name: Submit several transactions to chain - run: | - RUST_BACKTRACE=1 cargo run --example transaction_broadcast --all-features - RUST_BACKTRACE=1 cargo run --example contract_interaction --all-features - env: - TEST_TO_ADDRESS: ${{ secrets.TO_ADDRESS }} - TEST_MNEMONIC: ${{ secrets.MNEMONIC }} - coverage: name: Coverage runs-on: ubuntu-latest @@ -115,3 +94,25 @@ jobs: with: name: code-coverage-report path: cobertura.xml + + test-onchain: + name: Run chain-mosifying examples + runs-on: ubuntu-latest + needs: [coverage, build, lint] + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install nightly toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + + - name: Submit several transactions to chain + run: | + RUST_BACKTRACE=1 cargo run --example transaction_broadcast --all-features + RUST_BACKTRACE=1 cargo run --example contract_interaction --all-features + env: + TEST_TO_ADDRESS: ${{ secrets.TO_ADDRESS }} + TEST_MNEMONIC: ${{ secrets.MNEMONIC }} From a57be1b1e41b992c92d83a65a8389524cad619b8 Mon Sep 17 00:00:00 2001 From: STerliakov Date: Mon, 28 Apr 2025 05:43:16 +0200 Subject: [PATCH 4/4] Typo --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f479123..6a6fcec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,7 +96,7 @@ jobs: path: cobertura.xml test-onchain: - name: Run chain-mosifying examples + name: Run chain-modifying examples runs-on: ubuntu-latest needs: [coverage, build, lint] steps: