feat: executor, testing utilities, and improved tests #125
This file contains 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: CI | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
concurrency: | |
group: rust-validation-${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
RUST_BACKTRACE: full | |
RUST_LOG: "gadget=trace" | |
CARGO_TERM_COLOR: always | |
jobs: | |
formatting: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Check Formatting | |
run: cargo fmt -- --check | |
linting: | |
timeout-minutes: 120 | |
name: cargo clippy | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v2 | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: Verify Forge installation | |
run: forge --version | |
- name: install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- uses: swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: "true" | |
- name: install protobuf and gmp | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler libprotobuf-dev libgmp-dev | |
- name: Run Clippy | |
run: cargo clippy --tests --examples -- -D warnings | |
testing: | |
timeout-minutes: 30 | |
name: cargo test | |
runs-on: ubuntu-latest | |
env: | |
CARGO_TERM_COLOR: always | |
strategy: | |
fail-fast: false | |
matrix: | |
package: | |
[ | |
# Macros | |
gadget-blueprint-proc-macro, | |
gadget-blueprint-proc-macro-core, | |
gadget-context-derive, | |
# Clients | |
gadget-client-eigenlayer, | |
gadget-client-evm, | |
gadget-client-tangle, | |
# Crypto | |
gadget-crypto-sp-core, | |
gadget-crypto-ed25519, | |
gadget-crypto-bls, | |
gadget-crypto-k256, | |
gadget-crypto-sr25519, | |
# Event listeners | |
gadget-event-listeners-core, | |
gadget-event-listeners-evm, | |
gadget-event-listeners-cronjob, | |
gadget-event-listeners-tangle, | |
gadget-blueprint-serde, | |
gadget-config, | |
gadget-executor, | |
gadget-keystore, | |
gadget-std, | |
gadget-utils-tangle, | |
gadget-networking, | |
] | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v2 | |
- name: install rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: stable | |
- uses: swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: "true" | |
- name: install protobuf and gmp | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler libprotobuf-dev libgmp-dev | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: nextest | |
- name: tests | |
run: cargo nextest run --profile ci --package ${{ matrix.package }} | |
# TODO: nextest doesn't support doc tests yet (https://github.com/nextest-rs/nextest/issues/16) | |
- name: doc tests | |
run: cargo test --package ${{ matrix.package }} --doc ${{ matrix.package == 'gadget-networking' && '-- --test-threads=1' || '' }} |