From 25ab0f94f5b83397503c2062717b1c8f2329c0ef Mon Sep 17 00:00:00 2001 From: Paul Lange Date: Tue, 19 Sep 2023 14:50:24 +0200 Subject: [PATCH] chore(ci): check external types (#3152) This adds CI job that runs `cargo-check-external-types` against a whitelist of exported types. Closes #2925 Signed-off-by: Sven Pfennig --- .github/workflows/CI.yml | 24 ++++++++++++++++++++++++ .github/workflows/external-types.toml | 15 +++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .github/workflows/external-types.toml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3a591a6271..f1c9fdfb51 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -24,6 +24,7 @@ jobs: - ffi - ffi-header - doc + - check-external-types steps: - run: exit 0 @@ -210,3 +211,26 @@ jobs: - name: cargo doc run: cargo rustdoc --features full,ffi -- --cfg docsrs --cfg hyper_unstable_ffi -D broken-intra-doc-links + + check-external-types: + name: Check exposed types + needs: [style, test] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2023-05-31 # Compatible version for cargo-check-external-types + + - name: Install cargo-check-external-types + uses: actions-rs/install@v0.1 + with: + crate: cargo-check-external-types + version: 0.1.7 + use-tool-cache: true + + - name: check-external-types + run: cargo check-external-types --config .github/workflows/external-types.toml diff --git a/.github/workflows/external-types.toml b/.github/workflows/external-types.toml new file mode 100644 index 0000000000..23a83c1f02 --- /dev/null +++ b/.github/workflows/external-types.toml @@ -0,0 +1,15 @@ +allowed_external_types = [ + "bytes::buf::buf_impl::Buf", + "bytes::bytes::Bytes", + "http::header", + "http::header::map::HeaderMap", + "http::method::Method", + "http::request::Request", + "http::response::Response", + "http::status::StatusCode", + "http::uri::Uri", + "http::version::Version", + "http_body::Body", + "http_body::frame::Frame", + "http_body::size_hint::SizeHint", +]