Skip to content

CI

CI #6

Workflow file for this run

on: [push, pull_request]
name: CI
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
rust_version: ${{ steps.read_toolchain.outputs.rust_version }}
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Read rust version"
id: read_toolchain
run: echo "rust_version=$(cat rust-version)" >> $GITHUB_OUTPUT
build-test:
name: Build and test
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- version: stable
- version: 1.63.0 # MSRV
features:
- all
- debug,default
- debug,esplora
- debug,snap
- debug,bitcoind
steps:
- name: checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust.version }}
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Build
run: |
if [ "${{ matrix.features }}" = "all" ]; then
wasm-pack build --all-features
else
wasm-pack build --features ${{ matrix.features }}
fi
- name: Test
if: ${{ matrix.features != 'all' }}
run: wasm-pack test --chrome --firefox --safari --headless --features ${{ matrix.features }}
fmt:
name: Rust fmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- name: Check fmt
run: cargo fmt --all -- --config format_code_in_doc_comments=true --check
clippy_check:
needs: prepare
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ needs.prepare.outputs.rust_version }}
components: clippy
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Run Clippy
run: cargo clippy --all-features --all-targets -- -D warnings