Skip to content

Commit 8e93bd4

Browse files
committed
Add futures CI check
1 parent d3c369d commit 8e93bd4

File tree

6 files changed

+38
-15
lines changed

6 files changed

+38
-15
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,42 +12,51 @@ jobs:
1212
beta,
1313
# 1.41.1 is MSRV for Rust-Lightning, lightning-invoice, and lightning-persister
1414
1.41.1,
15-
# 1.45.2 is MSRV for lightning-net-tokio, lightning-block-sync, and coverage generation
15+
# 1.45.2 is MSRV for lightning-net-tokio, lightning-block-sync, lightning-background-processor, and coverage generation
1616
1.45.2,
1717
# 1.47.0 will be the MSRV for no-std builds using hashbrown once core2 is updated
1818
1.47.0]
1919
include:
2020
- toolchain: stable
2121
build-net-tokio: true
2222
build-no-std: true
23+
build-futures: true
2324
- toolchain: stable
2425
platform: macos-latest
2526
build-net-tokio: true
2627
build-no-std: true
28+
build-futures: true
2729
- toolchain: beta
2830
platform: macos-latest
2931
build-net-tokio: true
3032
build-no-std: true
33+
build-futures: true
3134
- toolchain: stable
3235
platform: windows-latest
3336
build-net-tokio: true
3437
build-no-std: true
38+
build-futures: true
3539
- toolchain: beta
3640
platform: windows-latest
3741
build-net-tokio: true
3842
build-no-std: true
43+
build-futures: true
3944
- toolchain: beta
4045
build-net-tokio: true
4146
build-no-std: true
47+
build-futures: true
4248
- toolchain: 1.41.1
4349
build-no-std: false
4450
test-log-variants: true
51+
build-futures: false
4552
- toolchain: 1.45.2
4653
build-net-old-tokio: true
4754
build-net-tokio: true
4855
build-no-std: false
56+
build-futures: true
4957
coverage: true
5058
- toolchain: 1.47.0
59+
build-futures: true
5160
build-no-std: true
5261
runs-on: ${{ matrix.platform }}
5362
steps:
@@ -109,7 +118,7 @@ jobs:
109118
- name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
110119
if: matrix.coverage
111120
run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
112-
- name: Test on no-std bullds Rust ${{ matrix.toolchain }}
121+
- name: Test no-std builds on Rust ${{ matrix.toolchain }}
113122
if: "matrix.build-no-std && !matrix.coverage"
114123
shell: bash # Default on Winblows is powershell
115124
run: |
@@ -140,15 +149,26 @@ jobs:
140149
run: |
141150
cd lightning
142151
RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
143-
cd ..
152+
- name: Test futures builds on Rust ${{ matrix.toolchain }}
153+
if: "matrix.build-futures && !matrix.coverage"
154+
shell: bash # Default on Winblows is powershell
155+
run: |
156+
cd lightning-background-processor
157+
cargo test --verbose --color always --no-default-features --features futures
158+
- name: Test futures builds on Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
159+
if: "matrix.build-futures && matrix.coverage"
160+
shell: bash # Default on Winblows is powershell
161+
run: |
162+
cd lightning-background-processor
163+
RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features futures
144164
- name: Test on Rust ${{ matrix.toolchain }}
145165
if: "! matrix.build-net-tokio"
146166
run: |
147-
cargo test --verbose --color always -p lightning
148-
cargo test --verbose --color always -p lightning-invoice
149-
cargo test --verbose --color always -p lightning-rapid-gossip-sync
150-
cargo build --verbose --color always -p lightning-persister
151-
cargo build --verbose --color always -p lightning-background-processor
167+
cargo test --verbose --color always -p lightning
168+
cargo test --verbose --color always -p lightning-invoice
169+
cargo test --verbose --color always -p lightning-rapid-gossip-sync
170+
cargo test --verbose --color always -p lightning-persister
171+
cargo test --verbose --color always -p lightning-background-processor
152172
- name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
153173
if: "! matrix.build-net-tokio"
154174
run: |
@@ -299,6 +319,7 @@ jobs:
299319
run: |
300320
cargo check --release
301321
cargo check --no-default-features --features=no-std --release
322+
cargo check --no-default-features --features=futures --release
302323
cargo doc --release
303324
304325
fuzz:

lightning-background-processor/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ edition = "2018"
1313
all-features = true
1414
rustdoc-args = ["--cfg", "docsrs"]
1515

16+
[features]
17+
futures = [ "futures-util" ]
18+
1619
[dependencies]
1720
bitcoin = "0.29.0"
1821
lightning = { version = "0.0.111", path = "../lightning", features = ["std"] }
1922
lightning-rapid-gossip-sync = { version = "0.0.111", path = "../lightning-rapid-gossip-sync" }
20-
futures = { version = "0.3", optional = true }
23+
futures-util = { version = "0.3", default-features = false, features = ["async-await-macro"], optional = true }
2124

2225
[dev-dependencies]
2326
lightning = { version = "0.0.111", path = "../lightning", features = ["_test_utils"] }

lightning-background-processor/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use std::time::{Duration, Instant};
3535
use std::ops::Deref;
3636

3737
#[cfg(feature = "futures")]
38-
use futures::{select, future::FutureExt};
38+
use futures_util::{select_biased, future::FutureExt};
3939

4040
/// `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
4141
/// Rust-Lightning running properly, and (2) either can or should be run in the background. Its
@@ -377,7 +377,6 @@ pub async fn process_events_async<
377377
P: 'static + Deref + Send + Sync,
378378
Descriptor: 'static + SocketDescriptor + Send + Sync,
379379
CMH: 'static + Deref + Send + Sync,
380-
CUMH: 'static + Deref + Send + Sync,
381380
RMH: 'static + Deref + Send + Sync,
382381
OMH: 'static + Deref + Send + Sync,
383382
EH: 'static + EventHandler + Send,
@@ -415,7 +414,7 @@ where
415414
let mut should_continue = true;
416415
define_run_body!(persister, event_handler, chain_monitor, channel_manager,
417416
gossip_sync, peer_manager, logger, scorer, should_continue, {
418-
select! {
417+
select_biased! {
419418
_ = channel_manager.get_persistable_update_future().fuse() => true,
420419
cont = sleeper(Duration::from_millis(100)).fuse() => {
421420
should_continue = cont;

lightning-block-sync/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ rpc-client = [ "serde", "serde_json", "chunked_transfer" ]
2020
[dependencies]
2121
bitcoin = "0.29.0"
2222
lightning = { version = "0.0.111", path = "../lightning" }
23-
futures = { version = "0.3" }
23+
futures-util = { version = "0.3" }
2424
tokio = { version = "1.0", features = [ "io-util", "net", "time" ], optional = true }
2525
serde = { version = "1.0", features = ["derive"], optional = true }
2626
serde_json = { version = "1.0", optional = true }

lightning-block-sync/src/rest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::http::{BinaryResponse, HttpEndpoint, HttpClient, JsonResponse};
77
use bitcoin::hash_types::BlockHash;
88
use bitcoin::hashes::hex::ToHex;
99

10-
use futures::lock::Mutex;
10+
use futures_util::lock::Mutex;
1111

1212
use std::convert::TryFrom;
1313
use std::convert::TryInto;

lightning-block-sync/src/rpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::http::{HttpClient, HttpEndpoint, HttpError, JsonResponse};
77
use bitcoin::hash_types::BlockHash;
88
use bitcoin::hashes::hex::ToHex;
99

10-
use futures::lock::Mutex;
10+
use futures_util::lock::Mutex;
1111

1212
use serde_json;
1313

0 commit comments

Comments
 (0)