on: [push, pull_request] name: CI jobs: build-test: name: Build and test runs-on: ubuntu-latest strategy: matrix: rust: - stable - 1.45.0 # MSRV features: - default - minimal - all-keys - minimal,esplora - key-value-db - electrum - compact_filters - cli-utils,esplora,key-value-db,electrum - compiler include: - rust: stable features: compact_filters clippy: skip - rust: 1.45.0 features: compact_filters clippy: skip steps: - name: checkout uses: actions/checkout@v2 - name: cache uses: actions/cache@v2 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} - name: Set default toolchain run: rustup default ${{ matrix.rust }} - name: Set profile run: rustup set profile minimal - name: Add clippy run: rustup component add clippy - name: Build run: cargo build --features ${{ matrix.features }} --no-default-features - name: Clippy if: ${{ matrix.rust == 'stable' && matrix.clippy != 'skip' }} run: cargo clippy -- -D warnings - name: Test if: ${{ matrix.test != 'skip' }} run: cargo test --features ${{ matrix.features }} --no-default-features test-electrum: name: Test electrum runs-on: ubuntu-16.04 container: bitcoindevkit/electrs env: MAGICAL_RPC_AUTH: USER_PASS MAGICAL_RPC_USER: admin MAGICAL_RPC_PASS: passw MAGICAL_RPC_URL: 127.0.0.1:18443 MAGICAL_ELECTRUM_URL: tcp://127.0.0.1:60401 steps: - name: Checkout uses: actions/checkout@v2 - name: Cache uses: actions/cache@v2 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} - name: Install rustup run: curl https://sh.rustup.rs -sSf | sh -s -- -y - name: Set default toolchain run: $HOME/.cargo/bin/rustup default stable - name: Set profile run: $HOME/.cargo/bin/rustup set profile minimal - name: Start core run: ./ci/start-core.sh - name: Test run: $HOME/.cargo/bin/cargo test --features test-electrum --no-default-features check-wasm: name: Check WASM runs-on: ubuntu-16.04 env: CC: clang-10 CFLAGS: -I/usr/include steps: - name: Checkout uses: actions/checkout@v2 - name: Cache uses: actions/cache@v2 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} # Install a recent version of clang that supports wasm32 - run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - || exit 1 - run: sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" || exit 1 - run: sudo apt-get update || exit 1 - run: sudo apt-get install -y clang-10 libc6-dev-i386 || exit 1 - name: Set default toolchain run: rustup default stable - name: Set profile run: rustup set profile minimal - name: Add target wasm32 run: rustup target add wasm32-unknown-unknown - name: Check run: cargo check --target wasm32-unknown-unknown --features cli-utils,esplora --no-default-features fmt: name: Rust fmt runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Set default toolchain run: rustup default stable - name: Set profile run: rustup set profile minimal - name: Add clippy run: rustup component add rustfmt - name: Check fmt run: cargo fmt --all -- --check