on:
  push:
    branches:
      - master
  pull_request: {}

name: CI

jobs:

  test-electrs:
    name: Test Electrs
    runs-on: ubuntu-20.04
    env:
      CARGO_TERM_COLOR: always
      RUST_LOG: debug
    strategy:
      matrix:
        features:
          - bitcoind_22_1,electrs_0_8_10
          - bitcoind_22_1,electrs_0_9_1
          - bitcoind_22_1,electrs_0_9_11
      fail-fast: false

    steps:
      - uses: actions/checkout@v3
      - uses: Swatinem/rust-cache@v2
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo test --features ${{ matrix.features }}


  test-electrs-esplora:
    name: Test Electrs Esplora
    runs-on: ubuntu-20.04
    env:
      CARGO_TERM_COLOR: always
    strategy:
      matrix:
        features: ["bitcoind_22_1,legacy,esplora_a33e97e1"]

    steps:
      - uses: actions/checkout@v3
      - uses: Swatinem/rust-cache@v2
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo test --features ${{ matrix.features }}


  cosmetics:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3
      - uses: Swatinem/rust-cache@v2
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo fmt -- --check
      - run: cargo clippy -- -D warnings
