WIP Add LSPS2ServiceEvent
handling
#634
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 Checks - Rust Tests | |
on: [push, pull_request] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
platform: [ | |
ubuntu-latest, | |
macos-latest, | |
windows-latest, | |
] | |
toolchain: [ | |
stable, | |
beta, | |
1.63.0, # Our MSRV | |
] | |
include: | |
- toolchain: stable | |
check-fmt: true | |
build-uniffi: true | |
platform: ubuntu-latest | |
- toolchain: stable | |
platform: macos-latest | |
- toolchain: stable | |
platform: windows-latest | |
- toolchain: 1.63.0 | |
msrv: true | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Install Rust ${{ matrix.toolchain }} toolchain | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }} | |
rustup override set ${{ matrix.toolchain }} | |
- name: Check formatting on Rust ${{ matrix.toolchain }} | |
if: matrix.check-fmt | |
run: rustup component add rustfmt && cargo fmt --all -- --check | |
- name: Pin packages to allow for MSRV | |
if: matrix.msrv | |
run: | | |
cargo update -p proptest --precise "1.2.0" --verbose # proptest 1.3.0 requires rustc 1.64.0 | |
cargo update -p regex --precise "1.9.6" --verbose # regex 1.10.0 requires rustc 1.65.0 | |
cargo update -p home --precise "0.5.5" --verbose # home v0.5.9 requires rustc 1.70 or newer | |
cargo update -p tokio --precise "1.38.1" --verbose # tokio v1.39.0 requires rustc 1.70 or newer | |
cargo update -p tokio-util --precise "0.7.11" --verbose # tokio-util v0.7.12 requires rustc 1.70 or newer | |
cargo update -p idna_adapter --precise "1.1.0" --verbose # url 2.5.3 switched to idna 1.0.3 and ICU4X, which requires rustc 1.67 or newer. Here we opt to keep using unicode-rs by pinning idna_adapter as described here: https://docs.rs/crate/idna_adapter/1.2.0 | |
cargo update -p indexmap --precise "2.5.0" --verbose # indexmap 2.6.0 upgraded to hashbrown 0.15, which unfortunately bumped their MSRV to rustc 1.65 with the 0.15.1 release | |
- name: Set RUSTFLAGS to deny warnings | |
if: "matrix.toolchain == 'stable'" | |
run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV" | |
- name: Enable caching for bitcoind | |
id: cache-bitcoind | |
uses: actions/cache@v4 | |
with: | |
path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }} | |
key: bitcoind-${{ runner.os }}-${{ runner.arch }} | |
- name: Enable caching for electrs | |
id: cache-electrs | |
uses: actions/cache@v4 | |
with: | |
path: bin/electrs-${{ runner.os }}-${{ runner.arch }} | |
key: electrs-${{ runner.os }}-${{ runner.arch }} | |
- name: Download bitcoind/electrs | |
if: "matrix.platform != 'windows-latest' && (steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')" | |
run: | | |
source ./scripts/download_bitcoind_electrs.sh | |
mkdir bin | |
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }} | |
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }} | |
- name: Set bitcoind/electrs environment variables | |
run: | | |
echo "BITCOIND_EXE=$( pwd )/bin/bitcoind-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV" | |
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV" | |
- name: Build on Rust ${{ matrix.toolchain }} | |
run: cargo build --verbose --color always | |
- name: Build with UniFFI support on Rust ${{ matrix.toolchain }} | |
if: matrix.build-uniffi | |
run: cargo build --features uniffi --verbose --color always | |
- name: Build documentation on Rust ${{ matrix.toolchain }} | |
if: "matrix.platform != 'windows-latest' || matrix.toolchain != '1.63.0'" | |
run: | | |
cargo doc --release --verbose --color always | |
cargo doc --document-private-items --verbose --color always | |
- name: Check release build on Rust ${{ matrix.toolchain }} | |
run: cargo check --release --verbose --color always | |
- name: Check release build with UniFFI support on Rust ${{ matrix.toolchain }} | |
if: matrix.build-uniffi | |
run: cargo check --release --features uniffi --verbose --color always | |
- name: Test on Rust ${{ matrix.toolchain }} | |
if: "matrix.platform != 'windows-latest'" | |
run: | | |
RUSTFLAGS="--cfg no_download" cargo test | |
- name: Test with UniFFI support on Rust ${{ matrix.toolchain }} | |
if: "matrix.platform != 'windows-latest' && matrix.build-uniffi" | |
run: | | |
RUSTFLAGS="--cfg no_download" cargo test --features uniffi |