.github/workflows: Refactor CI jobs (#3090)

We refactor our continuous integration workflow with the following goals in mind:

- Run as few jobs as possible
- Have the jobs finish as fast as possible
- Have the jobs redo as little work as possible

There are only so many jobs that GitHub Actions will run in parallel.
Thus, it makes sense to not create massive matrices but instead group
things together meaningfully.

The new `test` job will:

- Run once for each crate
- Ensure that the crate compiles on its specified MSRV
- Ensure that the tests pass
- Ensure that there are no semver violations

This is an improvement to before because we are running all of these
in parallel which speeds up execution and highlights more errors at
once. Previously, tests run later in the pipeline would not get run
at all until you make sure the "first" one passes.

We also previously did not verify the MSRV of each crate, making the
setting in the `Cargo.toml` rather pointless.

The new `cross` job supersedes the existing `wasm` job.

This is an improvement because we now also compile the crate for
windows and MacOS. Something that wasn't checked before.
We assume that checking MSRV and the tests under Linux is good enough.
Hence, this job only checks for compile-errors.

The new `feature_matrix` ensures we compile correctly with certain feature combinations.

`libp2p` exposes a fair few feature-flags. Some of the combinations
are worth checking independently. For the moment, this concerns only
the executor related transports together with the executor flags but
this list can easily be extended.

The new `clippy` job runs for `stable` and `beta` rust.

Clippy gets continuously extended with new lints. Up until now, we would only
learn about those as soon as a new version of Rust is released and CI would
run the new lints. This leads to unrelated failures in CI. Running clippy on with `beta`
Rust gives us a heads-up of 6 weeks before these lints land on stable.

Fixes #2951.
This commit is contained in:
Thomas Eizinger
2022-11-18 22:04:16 +11:00
committed by GitHub
parent 05c079422e
commit 0c85839dab
72 changed files with 363 additions and 208 deletions

View File

@ -9,7 +9,10 @@
- Replace `Behaviour`'s `NetworkBehaviour` implemention `inject_*` methods with the new `on_*` methods.
See [PR 3011].
- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090].
[PR 3011]: https://github.com/libp2p/rust-libp2p/pull/3011
[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090
# 0.8.0

View File

@ -1,7 +1,7 @@
[package]
name = "libp2p-autonat"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.62.0"
description = "NAT and firewall detection for libp2p"
version = "0.9.0"
authors = ["David Craven <david@craven.ch>", "Elena Frank <elena.frank@protonmail.com>"]

View File

@ -150,7 +150,7 @@ impl<'a> HandleInnerEvent for AsClient<'a> {
// Update observed address score if it is finite.
let score = params
.external_addresses()
.find_map(|r| (r.addr == address).then(|| r.score))
.find_map(|r| (r.addr == address).then_some(r.score))
.unwrap_or(AddressScore::Finite(0));
if let AddressScore::Finite(finite_score) = score {
action = Some(NetworkBehaviourAction::ReportObservedAddr {
@ -266,7 +266,7 @@ impl<'a> AsClient<'a> {
// Filter servers for which no qualified address is known.
// This is the case if the connection is relayed or the address is
// not global (in case of Config::only_global_ips).
addrs.values().any(|a| a.is_some()).then(|| id)
addrs.values().any(|a| a.is_some()).then_some(id)
}));
}

View File

@ -346,7 +346,7 @@ impl<'a> AsServer<'a> {
addr.push(Protocol::P2p(peer.into()))
}
// Only collect distinct addresses.
distinct.insert(addr.clone()).then(|| addr)
distinct.insert(addr.clone()).then_some(addr)
})
.collect()
}

View File

@ -12,8 +12,11 @@
- Replace `direct::Handler` and `relayed::Handler`'s `ConnectionHandler` implemention `inject_*`
methods with the new `on_*` methods. See [PR 3085].
- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090].
[PR 3085]: https://github.com/libp2p/rust-libp2p/pull/3085
[PR 3011]: https://github.com/libp2p/rust-libp2p/pull/3011
[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090
# 0.7.0

View File

@ -1,7 +1,7 @@
[package]
name = "libp2p-dcutr"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.62.0"
description = "Direct connection upgrade through relay"
version = "0.8.0"
authors = ["Max Inden <mail@max-inden.de>"]

View File

@ -183,7 +183,7 @@ impl Behaviour {
.expect("Peer of direct connection to be tracked.");
connections
.remove(&connection_id)
.then(|| ())
.then_some(())
.expect("Direct connection to be tracked.");
if connections.is_empty() {
self.direct_connections.remove(&peer_id);

View File

@ -7,7 +7,10 @@
- Replace `Floodsub`'s `NetworkBehaviour` implemention `inject_*` methods with the new `on_*` methods.
See [PR 3011].
- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090].
[PR 3011]: https://github.com/libp2p/rust-libp2p/pull/3011
[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090
# 0.40.0

View File

@ -1,7 +1,7 @@
[package]
name = "libp2p-floodsub"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.62.0"
description = "Floodsub protocol for libp2p"
version = "0.41.0"
authors = ["Parity Technologies <admin@parity.io>"]

View File

@ -8,15 +8,18 @@
- Refactoring GossipsubCodec to use common protobuf Codec. See [PR 3070].
- Replace `Gossipsub`'s `NetworkBehaviour` implemention `inject_*` methods with the new `on_*` methods.
- Replace `Gossipsub`'s `NetworkBehaviour` implementation `inject_*` methods with the new `on_*` methods.
See [PR 3011].
- Replace `GossipsubHandler`'s `ConnectionHandler` implemention `inject_*` methods with the new `on_*` methods.
- Replace `GossipsubHandler`'s `ConnectionHandler` implementation `inject_*` methods with the new `on_*` methods.
See [PR 3085].
- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090].
[PR 3085]: https://github.com/libp2p/rust-libp2p/pull/3085
[PR 3070]: https://github.com/libp2p/rust-libp2p/pull/3070
[PR 3011]: https://github.com/libp2p/rust-libp2p/pull/3011
[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090
# 0.42.0

View File

@ -1,7 +1,7 @@
[package]
name = "libp2p-gossipsub"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.62.0"
description = "Gossipsub protocol for libp2p"
version = "0.43.0"
authors = ["Age Manning <Age@AgeManning.com>"]

View File

@ -14,9 +14,12 @@
- Replace `Handler`'s `ConnectionHandler` implemention `inject_*` methods with the new `on_*` methods.
See [PR 3085].
- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090].
[PR 3085]: https://github.com/libp2p/rust-libp2p/pull/3085
[PR 3011]: https://github.com/libp2p/rust-libp2p/pull/3011
[PR 2995]: https://github.com/libp2p/rust-libp2p/pull/2995
[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090
# 0.40.0

View File

@ -1,7 +1,7 @@
[package]
name = "libp2p-identify"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.62.0"
description = "Nodes identifcation protocol for libp2p"
version = "0.41.0"
authors = ["Parity Technologies <admin@parity.io>"]

View File

@ -10,8 +10,11 @@
- Replace `KademliaHandler`'s `ConnectionHandler` implemention `inject_*` methods with the new `on_*` methods.
See [PR 3085].
- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090].
[PR 3085]: https://github.com/libp2p/rust-libp2p/pull/3085
[PR 3011]: https://github.com/libp2p/rust-libp2p/pull/3011
[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090
# 0.41.0

View File

@ -1,7 +1,7 @@
[package]
name = "libp2p-kad"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.62.0"
description = "Kademlia protocol for libp2p"
version = "0.42.0"
authors = ["Parity Technologies <admin@parity.io>"]

View File

@ -17,10 +17,13 @@ and move and rename `Mdns` to `async_io::Behaviour`. See [PR 3096].
- Use `trust-dns-proto` to parse DNS messages. See [PR 3102].
- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090].
[discussion 2174]: https://github.com/libp2p/rust-libp2p/discussions/2174
[PR 3096]: https://github.com/libp2p/rust-libp2p/pull/3096
[PR 3011]: https://github.com/libp2p/rust-libp2p/pull/3011
[PR 3102]: https://github.com/libp2p/rust-libp2p/pull/3102
[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090
# 0.41.0

View File

@ -1,7 +1,7 @@
[package]
name = "libp2p-mdns"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.62.0"
version = "0.42.0"
description = "Implementation of the libp2p mDNS discovery method"
authors = ["Parity Technologies <admin@parity.io>"]

View File

@ -10,8 +10,11 @@
- Replace `Handler`'s `ConnectionHandler` implemention `inject_*` methods with the new `on_*` methods.
See [PR 3085].
- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090].
[PR 3085]: https://github.com/libp2p/rust-libp2p/pull/3085
[PR 3011]: https://github.com/libp2p/rust-libp2p/pull/3011
[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090
# 0.40.0

View File

@ -1,7 +1,7 @@
[package]
name = "libp2p-ping"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.62.0"
description = "Ping protocol for libp2p"
version = "0.41.0"
authors = ["Parity Technologies <admin@parity.io>"]

View File

@ -12,8 +12,11 @@
- Replace `client::Handler` and `relay::Handler`'s `ConnectionHandler` implemention `inject_*` methods
with the new `on_*` methods. See [PR 3085].
- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090].
[PR 3085]: https://github.com/libp2p/rust-libp2p/pull/3085
[PR 3011]: https://github.com/libp2p/rust-libp2p/pull/3011
[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090
# 0.13.0

View File

@ -1,7 +1,7 @@
[package]
name = "libp2p-relay"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.62.0"
description = "Communications relaying for libp2p"
version = "0.14.0"
authors = ["Parity Technologies <admin@parity.io>", "Max Inden <mail@max-inden.de>"]

View File

@ -9,8 +9,11 @@
- Replace `Client` and `Server`'s `NetworkBehaviour` implemention `inject_*` methods with the new `on_*` methods.
See [PR 3011].
- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090].
[PR 3011]: https://github.com/libp2p/rust-libp2p/pull/3011
[PR 3058]: https://github.com/libp2p/rust-libp2p/pull/3058
[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090
# 0.10.0

View File

@ -1,7 +1,7 @@
[package]
name = "libp2p-rendezvous"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.62.0"
description = "Rendezvous protocol for libp2p"
version = "0.11.0"
authors = ["The COMIT guys <hello@comit.network>"]

View File

@ -178,7 +178,7 @@ impl NetworkBehaviour for Behaviour {
fn addresses_of_peer(&mut self, peer: &PeerId) -> Vec<Multiaddr> {
self.discovered_peers
.iter()
.filter_map(|((candidate, _), addresses)| (candidate == peer).then(|| addresses))
.filter_map(|((candidate, _), addresses)| (candidate == peer).then_some(addresses))
.flatten()
.cloned()
.collect()

View File

@ -10,8 +10,11 @@
- Replace `RequestResponseHandler`'s `ConnectionHandler` implemention `inject_*` methods
with the new `on_*` methods. See [PR 3085].
- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090].
[PR 3085]: https://github.com/libp2p/rust-libp2p/pull/3085
[PR 3011]: https://github.com/libp2p/rust-libp2p/pull/3011
[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090
# 0.22.0

View File

@ -1,7 +1,7 @@
[package]
name = "libp2p-request-response"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.62.0"
description = "Generic Request/Response Protocols"
version = "0.23.0"
authors = ["Parity Technologies <admin@parity.io>"]