Add Github CI workflow #123
Workflow file for this run
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: | |
push: | |
branches: [main] | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
checks: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: taiki-e/install-action@cargo-hack | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: cargo hack | |
run: cargo hack check --feature-powerset --depth 2 | |
examples: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: foundry-rs/foundry-toolchain@v1 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Run examples | |
run: | | |
# Get the list of runable examples | |
export examples="$( | |
cargo run --example 2>&1 \ | |
| grep -E '^ ' \ | |
| grep -v \ | |
-e 'trezor_signer' \ | |
-e 'ledger_signer' \ | |
-e 'yubi_signer' \ | |
-e 'ipc' \ | |
-e 'ws' \ | |
-e 'ws_auth' \ | |
-e 'query_logs' \ | |
| xargs -n1 echo | |
)" | |
# Log the examples to run | |
echo "Running the following examples: $examples" | |
# Run the examples | |
echo "$examples" | xargs -n1 cargo run --example | |
clippy: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- run: cargo clippy --workspace --all-targets --all-features | |
env: | |
RUSTFLAGS: -Dwarnings | |
fmt: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- run: cargo fmt --all --check |