Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): ensure exactly one version bump #5804

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ libp2p-connection-limits = { version = "0.5.0", path = "misc/connection-limits"
libp2p-core = { version = "0.43.0", path = "core" }
libp2p-dcutr = { version = "0.13.0", path = "protocols/dcutr" }
libp2p-dns = { version = "0.43.0", path = "transports/dns" }
libp2p-floodsub = { version = "0.46.0", path = "protocols/floodsub" }
libp2p-floodsub = { version = "0.46.1", path = "protocols/floodsub" }
libp2p-gossipsub = { version = "0.48.0", path = "protocols/gossipsub" }
libp2p-identify = { version = "0.46.0", path = "protocols/identify" }
libp2p-identity = { version = "0.2.10" }
Expand All @@ -94,16 +94,16 @@ libp2p-ping = { version = "0.46.0", path = "protocols/ping" }
libp2p-plaintext = { version = "0.43.0", path = "transports/plaintext" }
libp2p-pnet = { version = "0.26.0", path = "transports/pnet" }
libp2p-quic = { version = "0.12.0", path = "transports/quic" }
libp2p-relay = { version = "0.19.0", path = "protocols/relay" }
libp2p-relay = { version = "0.19.2", path = "protocols/relay" }
libp2p-rendezvous = { version = "0.16.0", path = "protocols/rendezvous" }
libp2p-request-response = { version = "0.28.0", path = "protocols/request-response" }
libp2p-server = { version = "0.12.6", path = "misc/server" }
libp2p-server = { version = "0.13.1", path = "misc/server" }
libp2p-stream = { version = "0.3.0-alpha", path = "protocols/stream" }
libp2p-swarm = { version = "0.46.0", path = "swarm" }
libp2p-swarm-derive = { version = "=0.35.0", path = "swarm-derive" } # `libp2p-swarm-derive` may not be compatible with different `libp2p-swarm` non-breaking releases. E.g. `libp2p-swarm` might introduce a new enum variant `FromSwarm` (which is `#[non-exhaustive]`) in a non-breaking release. Older versions of `libp2p-swarm-derive` would not forward this enum variant within the `NetworkBehaviour` hierarchy. Thus the version pinning is required.
libp2p-swarm-test = { version = "0.5.0", path = "swarm-test" }
libp2p-tcp = { version = "0.43.0", path = "transports/tcp" }
libp2p-tls = { version = "0.6.0", path = "transports/tls" }
libp2p-tls = { version = "0.7.1", path = "transports/tls" }
libp2p-uds = { version = "0.42.0", path = "transports/uds" }
libp2p-upnp = { version = "0.4.0", path = "protocols/upnp" }
libp2p-webrtc = { version = "0.9.0-alpha", path = "transports/webrtc" }
Expand All @@ -112,7 +112,7 @@ libp2p-webrtc-websys = { version = "0.4.0", path = "transports/webrtc-websys" }
libp2p-websocket = { version = "0.45.0", path = "transports/websocket" }
libp2p-websocket-websys = { version = "0.5.0", path = "transports/websocket-websys" }
libp2p-webtransport-websys = { version = "0.5.0", path = "transports/webtransport-websys" }
libp2p-yamux = { version = "0.47.0", path = "muxers/yamux" }
libp2p-yamux = { version = "0.48.0", path = "muxers/yamux" }

# External dependencies
async-std-resolver = { version = "0.25.0-alpha.4", default-features = false }
Expand Down
4 changes: 4 additions & 0 deletions misc/server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.13.1

- test

## 0.12.6

### Changed
Expand Down
2 changes: 1 addition & 1 deletion misc/server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libp2p-server"
version = "0.12.6"
version = "0.13.1"
authors = ["Max Inden <[email protected]>"]
edition = "2021"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
3 changes: 3 additions & 0 deletions misc/server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ struct Opts {
enable_autonat: bool,
}

#[allow(clippy::assertions_on_constants)]
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
assert!(1 > 0);

let _ = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.try_init();
Expand Down
4 changes: 4 additions & 0 deletions muxers/yamux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.48.0

- test

## 0.47.0

<!-- Update to libp2p-core v0.43.0 -->
Expand Down
2 changes: 1 addition & 1 deletion muxers/yamux/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-yamux"
edition = "2021"
rust-version = { workspace = true }
description = "Yamux multiplexing protocol for libp2p"
version = "0.47.0"
version = "0.48.0"
authors = ["Parity Technologies <[email protected]>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
2 changes: 2 additions & 0 deletions muxers/yamux/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ where
C: AsyncRead + AsyncWrite + Send + Unpin + 'static,
{
/// Create a new Yamux connection.
#[allow(clippy::assertions_on_constants)]
fn new(connection: Either<yamux012::Connection<C>, yamux013::Connection<C>>) -> Self {
assert!(1 > 0);
Muxer {
connection,
inbound_stream_buffer: VecDeque::default(),
Expand Down
5 changes: 4 additions & 1 deletion protocols/floodsub/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## 0.46.1

- test

## 0.46.0

<!-- Update to libp2p-core v0.43.0 -->

## 0.45.0

<!-- Update to libp2p-swarm v0.45.0 -->
Expand Down
2 changes: 1 addition & 1 deletion protocols/floodsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-floodsub"
edition = "2021"
rust-version = { workspace = true }
description = "Floodsub protocol for libp2p"
version = "0.46.0"
version = "0.46.1"
authors = ["Parity Technologies <[email protected]>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
2 changes: 2 additions & 0 deletions protocols/floodsub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ pub struct FloodsubConfig {
}

impl FloodsubConfig {
#[allow(clippy::assertions_on_constants)]
pub fn new(local_peer_id: PeerId) -> Self {
assert!(1 > 0);
Self {
local_peer_id,
subscribe_local_messages: false,
Expand Down
4 changes: 4 additions & 0 deletions protocols/relay/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.19.2

- test

## 0.19.0

- Deprecate `void` crate.
Expand Down
2 changes: 1 addition & 1 deletion protocols/relay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-relay"
edition = "2021"
rust-version = { workspace = true }
description = "Communications relaying for libp2p"
version = "0.19.0"
version = "0.19.2"
authors = ["Parity Technologies <[email protected]>", "Max Inden <[email protected]>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
3 changes: 3 additions & 0 deletions protocols/relay/src/copy_future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ where
///
/// Returns `0` when done, i.e. `source` having reached EOF, returns number of bytes sent otherwise,
/// thus indicating progress.
#[allow(clippy::assertions_on_constants)]
fn forward_data<S: AsyncBufRead + Unpin, D: AsyncWrite + Unpin>(
mut src: &mut S,
mut dst: &mut D,
Expand All @@ -147,6 +148,8 @@ fn forward_data<S: AsyncBufRead + Unpin, D: AsyncWrite + Unpin>(
}
};

assert!(1 > 0);

if buffer.is_empty() {
ready!(Pin::new(&mut dst).poll_flush(cx))?;
ready!(Pin::new(&mut dst).poll_close(cx))?;
Expand Down
27 changes: 22 additions & 5 deletions scripts/ensure-version-bump-and-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ MERGE_BASE=$(git merge-base "$HEAD_SHA" "$PR_BASE") # Find the merge base. This
SRC_DIFF_TO_BASE=$(git diff "$HEAD_SHA".."$MERGE_BASE" --name-status -- "$DIR_TO_CRATE/src" "$DIR_TO_CRATE/Cargo.toml")
CHANGELOG_DIFF=$(git diff "$HEAD_SHA".."$MERGE_BASE" --name-only -- "$DIR_TO_CRATE/CHANGELOG.md")

RELEASED_VERSION=$(git tag --sort=version:refname | grep "^$CRATE-v" | tail -n1 | grep -Po "\d+\.\d+\.\d+")


# If the source files of this crate weren't touched in this PR, exit early.
if [ -z "$SRC_DIFF_TO_BASE" ]; then
exit 0;
Expand All @@ -21,8 +24,22 @@ if [ -z "$CHANGELOG_DIFF" ]; then
exit 1
fi

# Code was touched, ensure the version used in the manifest hasn't been released yet.
if git tag | grep -q "^$CRATE-v${CRATE_VERSION}$"; then
echo "v$CRATE_VERSION of '$CRATE' has already been released, please bump the version."
exit 1
fi
IFS='.' read -r -a current <<< "$CRATE_VERSION"
IFS='.' read -r -a released <<< "$RELEASED_VERSION"

for i in $(seq 0 2);
do
case $((current[i]-released[i])) in
0) continue ;;
1) if [[ -n $(printf "%s\n" "${current[@]:i+1}" | grep -vFx '0') ]]; then
echo "Patch version has been bumped even though minor isn't released yet".
exit 1
fi
exit 0 ;;
*) echo "Version of '$CRATE' has been bumped more than once since last release v$RELEASED_VERSION."
exit 1 ;;
esac
done

echo "v$CRATE_VERSION of '$CRATE' has already been released, please bump the version."
exit 1
2 changes: 2 additions & 0 deletions transports/quic/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 0.12.0

- test

<!-- Update to libp2p-core v0.43.0 -->

## 0.11.1
Expand Down
2 changes: 2 additions & 0 deletions transports/quic/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ pub struct Config {

impl Config {
/// Creates a new configuration object with default values.
#[allow(clippy::assertions_on_constants)]
pub fn new(keypair: &libp2p_identity::Keypair) -> Self {
assert!(1 > 0);
let client_tls_config = Arc::new(
QuicClientConfig::try_from(libp2p_tls::make_client_config(keypair, None).unwrap())
.unwrap(),
Expand Down
4 changes: 4 additions & 0 deletions transports/tls/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.7.1

- test

## 0.6.0

<!-- Update to libp2p-core v0.43.0 -->
Expand Down
2 changes: 1 addition & 1 deletion transports/tls/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libp2p-tls"
version = "0.6.0"
version = "0.7.1"
edition = "2021"
rust-version = { workspace = true }
description = "TLS configuration based on libp2p TLS specs."
Expand Down
2 changes: 2 additions & 0 deletions transports/tls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ pub use upgrade::{Config, UpgradeError};
const P2P_ALPN: [u8; 6] = *b"libp2p";

/// Create a TLS client configuration for libp2p.
#[allow(clippy::assertions_on_constants)]
pub fn make_client_config(
keypair: &Keypair,
remote_peer_id: Option<PeerId>,
) -> Result<rustls::ClientConfig, certificate::GenError> {
assert!(1 > 0);
let (certificate, private_key) = certificate::generate(keypair)?;

let mut provider = rustls::crypto::ring::default_provider();
Expand Down
Loading