From e6ff0281ae55ecfd051699b045e6eae4b033cecf Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Thu, 16 Feb 2023 22:41:41 +0100 Subject: [PATCH] Try `cargo public-api-crates` on CI (#1761) --- .github/workflows/CI.yml | 19 +++++++++++++++++++ axum-core/Cargo.toml | 9 +++++++++ axum-extra/Cargo.toml | 19 +++++++++++++++++++ axum-macros/Cargo.toml | 3 +++ axum/Cargo.toml | 17 +++++++++++++++++ 5 files changed, 67 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a6d15ca4..2dbafcdc 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -74,6 +74,25 @@ jobs: - name: cargo hack check run: cargo hack check --each-feature --no-dev-deps --all + cargo-public-api-crates: + runs-on: ubuntu-latest + strategy: + matrix: + crate: [axum, axum-core, axum-extra, axum-macros] + steps: + - uses: actions/checkout@master + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + override: true + profile: minimal + - uses: Swatinem/rust-cache@v1 + - name: Install cargo-public-api-crates + run: | + cargo install --git https://github.com/davidpdrsn/cargo-public-api-crates + - name: cargo public-api-crates check + run: cargo public-api-crates --manifest-path ${{ matrix.crate }}/Cargo.toml check + test-versions: needs: check runs-on: ubuntu-latest diff --git a/axum-core/Cargo.toml b/axum-core/Cargo.toml index 1035f0ec..0a21e94d 100644 --- a/axum-core/Cargo.toml +++ b/axum-core/Cargo.toml @@ -30,3 +30,12 @@ futures-util = "0.3" hyper = "0.14" tokio = { version = "1.0", features = ["macros"] } tower-http = { version = "0.3.4", features = ["limit"] } + +[package.metadata.cargo-public-api-crates] +allowed = [ + "futures_core", + "http", + "bytes", + "http_body", + "tower_layer", +] diff --git a/axum-extra/Cargo.toml b/axum-extra/Cargo.toml index 9bcf5da4..4fa4396c 100644 --- a/axum-extra/Cargo.toml +++ b/axum-extra/Cargo.toml @@ -73,3 +73,22 @@ tower-http = { version = "0.3", features = ["map-response-body", "timeout"] } [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.cargo-public-api-crates] +allowed = [ + "axum", + "axum_core", + "bytes", + "cookie", + "futures_core", + "futures_util", + "http", + "http_body", + "hyper", + "percent_encoding", + "prost", + "serde", + "tokio", + "tower_layer", + "tower_service", +] diff --git a/axum-macros/Cargo.toml b/axum-macros/Cargo.toml index 1b224dc6..46e73be3 100644 --- a/axum-macros/Cargo.toml +++ b/axum-macros/Cargo.toml @@ -37,3 +37,6 @@ serde_json = "1.0" syn = { version = "1.0", features = ["full", "extra-traits"] } tokio = { version = "1.0", features = ["full"] } trybuild = "1.0.63" + +[package.metadata.cargo-public-api-crates] +allowed = [] diff --git a/axum/Cargo.toml b/axum/Cargo.toml index 1162c557..d69448fa 100644 --- a/axum/Cargo.toml +++ b/axum/Cargo.toml @@ -110,6 +110,23 @@ features = [ "ws", ] +[package.metadata.cargo-public-api-crates] +allowed = [ + "axum_core", + "bytes", + "futures_core", + "futures_sink", + "futures_util", + "headers_core", + "http", + "http_body", + "hyper", + "serde", + "serde_json", + "tower_layer", + "tower_service", +] + [[bench]] name = "benches" harness = false