Skip to content

ci: separate lint and coverage runs #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 46 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -59,22 +59,32 @@ 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 +nightly rdme --check
run: cargo rdme --check

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

- 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

- 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
env:
TEST_TO_ADDRESS: ${{ secrets.TO_ADDRESS }}
TEST_MNEMONIC: ${{ secrets.MNEMONIC }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
env:
Expand All @@ -84,3 +94,25 @@ jobs:
with:
name: code-coverage-report
path: cobertura.xml

test-onchain:
name: Run chain-modifying 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 }}
Loading