Improve test reliability (#45) #421
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
schedule: | |
- cron: 0 0 * * 1 | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build 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 | |
matrix: | |
rust: | |
- 1.81.0 # MSRV | |
- stable | |
- beta | |
- nightly | |
os: [ubuntu, windows, macos] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: ${{matrix.rust}} | |
- name: Release build | |
run: cargo build --release --all-features | |
- name: Quick test | |
# 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 | |
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: | |
toolchain: nightly | |
components: rustfmt, clippy | |
- uses: pre-commit/[email protected] | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: taiki-e/install-action@v2 # zizmor: ignore[ref-confusion] | |
with: | |
tool: cargo-tarpaulin,cargo-rdme | |
- name: Check README is up-to-date | |
run: cargo +nightly rdme --check | |
- 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: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-report | |
path: cobertura.xml |