|
| 1 | +on: [push, pull_request] |
| 2 | + |
| 3 | +# Main continuous integration workflow that runs build, test, and code quality checks. |
| 4 | +# Runs on every push and pull request, testing against both MSRV (1.85) and stable Rust. |
| 5 | +# # Includes no_std and WASM compatibility checks, formatting validation, and clippy linting. |
| 6 | + |
| 7 | +name: CI |
| 8 | + |
| 9 | +permissions: {} |
| 10 | + |
| 11 | +env: |
| 12 | + CARGO_TERM_COLOR: always |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-test-msrv: |
| 16 | + name: Build & Test MSRV |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + os: |
| 21 | + - ubuntu-latest |
| 22 | + - ubuntu-24.04-arm |
| 23 | + features: |
| 24 | + - --no-default-features --features tokio |
| 25 | + - --all-features |
| 26 | + exclude: |
| 27 | + # electrsd does not provide ARM binaries, so integration tests fail on ARM |
| 28 | + - os: ubuntu-24.04-arm |
| 29 | + features: --all-features |
| 30 | + steps: |
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@v6 |
| 33 | + with: |
| 34 | + persist-credentials: false |
| 35 | + # The 'toolchain' argument on this action overrides the Rust compiler version set in rust-toolchain.toml |
| 36 | + # in order to test our MSRV. |
| 37 | + - name: Install Rust toolchain |
| 38 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 39 | + with: |
| 40 | + toolchain: 1.85 # MSRV |
| 41 | + cache: true |
| 42 | + - name: Pin dependencies for MSRV |
| 43 | + run: ./ci/pin-msrv.sh |
| 44 | + - name: Build + Test |
| 45 | + run: | |
| 46 | + cargo build --workspace --all-targets ${{ matrix.features }} |
| 47 | + cargo test --workspace ${{ matrix.features }} |
| 48 | +
|
| 49 | + build-test-stable: |
| 50 | + name: Build & Test Rust Stable |
| 51 | + runs-on: ${{ matrix.os }} |
| 52 | + strategy: |
| 53 | + matrix: |
| 54 | + os: |
| 55 | + - ubuntu-latest |
| 56 | + - ubuntu-24.04-arm |
| 57 | + features: |
| 58 | + - --no-default-features --features tokio |
| 59 | + - --all-features |
| 60 | + exclude: |
| 61 | + # electrsd does not provide ARM binaries, so integration tests fail on ARM |
| 62 | + - os: ubuntu-24.04-arm |
| 63 | + features: --all-features |
| 64 | + steps: |
| 65 | + - name: Checkout |
| 66 | + uses: actions/checkout@v6 |
| 67 | + with: |
| 68 | + persist-credentials: false |
| 69 | + - name: Install Rust toolchain |
| 70 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 71 | + with: |
| 72 | + cache: true |
| 73 | + - name: Build + Test |
| 74 | + run: | |
| 75 | + cargo build --workspace --all-targets ${{ matrix.features }} |
| 76 | + cargo test --workspace ${{ matrix.features }} |
| 77 | +
|
| 78 | + check-no-std: |
| 79 | + name: Check no_std |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - name: Checkout |
| 83 | + uses: actions/checkout@v6 |
| 84 | + with: |
| 85 | + persist-credentials: false |
| 86 | + - name: Install Rust toolchain |
| 87 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 88 | + with: |
| 89 | + cache: true |
| 90 | + - name: Check no-std |
| 91 | + run: cargo check --workspace --all-targets --no-default-features --features tokio |
| 92 | + |
| 93 | + check-wasm: |
| 94 | + name: Check WASM |
| 95 | + runs-on: ubuntu-latest |
| 96 | + env: |
| 97 | + CC: clang-14 |
| 98 | + CFLAGS: -I/usr/include |
| 99 | + steps: |
| 100 | + - name: Checkout |
| 101 | + uses: actions/checkout@v6 |
| 102 | + with: |
| 103 | + persist-credentials: false |
| 104 | + - run: wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - || exit 1 |
| 105 | + - run: sudo apt-get update || true |
| 106 | + - run: sudo apt-get install -y libclang-common-14-dev clang-14 libc6-dev-i386 || exit 1 |
| 107 | + - name: Install Rust toolchain |
| 108 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 109 | + with: |
| 110 | + cache: true |
| 111 | + target: wasm32-unknown-unknown |
| 112 | + - name: Check-WASM |
| 113 | + run: | |
| 114 | + rustup target add wasm32-unknown-unknown |
| 115 | + cargo check --workspace --no-default-features --target wasm32-unknown-unknown |
| 116 | +
|
| 117 | + fmt: |
| 118 | + name: Rust fmt |
| 119 | + runs-on: ubuntu-latest |
| 120 | + steps: |
| 121 | + - name: Checkout |
| 122 | + uses: actions/checkout@v6 |
| 123 | + with: |
| 124 | + persist-credentials: false |
| 125 | + - name: Install Rust toolchain |
| 126 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 127 | + with: |
| 128 | + cache: true |
| 129 | + - name: Check fmt |
| 130 | + run: cargo fmt --all -- --check |
| 131 | + |
| 132 | + clippy_check: |
| 133 | + name: Rust Clippy |
| 134 | + runs-on: ubuntu-latest |
| 135 | + permissions: |
| 136 | + checks: write |
| 137 | + steps: |
| 138 | + - name: Checkout |
| 139 | + uses: actions/checkout@v6 |
| 140 | + with: |
| 141 | + persist-credentials: false |
| 142 | + - name: Install Rust toolchain |
| 143 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 144 | + with: |
| 145 | + cache: true |
| 146 | + - name: Check Clippy |
| 147 | + run: cargo clippy --workspace --all-targets -- -D warnings |
0 commit comments