From 18e1ffb147bb0356e3c7547320ecb17a187600c0 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 17 Jun 2022 10:20:56 -0700 Subject: [PATCH 1/9] ci: run MSRV checks with minimal dep versions In many cases, new releases of a dependency can break compatibility with Tower's minimum supported Rust version (MSRV). It shouldn't be necessary for Tower to bump its MSRV when a dependency does, as users on older Rust versions should be able to depend on older versions of that crate. Instead, we should probably just run our MSRV checks with minimal dependency versions. This branch changes Tower's CI jobs to do that. Signed-off-by: Eliza Weisman --- .github/workflows/CI.yml | 55 ++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e1c1e1608..652aef178 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,18 +6,18 @@ on: - master pull_request: {} +env: + MSRV: 1.40.0 + jobs: - check: + check-stable: # Run `cargo check` first to ensure that the pushed code at least compiles. runs-on: ubuntu-latest - strategy: - matrix: - rust: [stable, 1.40.0] steps: - uses: actions/checkout@master - uses: actions-rs/toolchain@v1 with: - toolchain: ${{ matrix.rust }} + toolchain: stable profile: minimal - name: Check uses: actions-rs/cargo@v1 @@ -25,6 +25,22 @@ jobs: command: check args: --all --all-targets --all-features + check-msrv: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: "install Rust ${{ env.MSRV }}" + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.MSRV }} + profile: minimal + - name: install cargo-hack + uses: taiki-e/install-action@cargo-hack + - name: install cargo-minimal-versions + uses: taiki-e/install-action@cargo-minimal-versions + - name: Check + run: cargo minimal-versions check --all --all-targets --all-features + cargo-hack: runs-on: ubuntu-latest steps: @@ -33,9 +49,8 @@ jobs: with: toolchain: stable profile: minimal - - name: Install cargo-hack - run: | - curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin + - name: install cargo-hack + uses: taiki-e/install-action@cargo-hack - name: cargo hack check working-directory: ${{ matrix.subcrate }} run: cargo hack check --each-feature --no-dev-deps --all @@ -46,10 +61,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - rust: [stable, beta, nightly, 1.40.0] + rust: [stable, beta, nightly] steps: - uses: actions/checkout@master - - uses: actions-rs/toolchain@v1 + - name: "install Rust ${{ matrix.rust }}" + uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.rust }} profile: minimal @@ -59,6 +75,23 @@ jobs: command: test args: --all --all-features + test-msrv: + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: "install Rust ${{ env.MSRV }}" + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.MSRV }} + profile: minimal + - name: install cargo-hack + uses: taiki-e/install-action@cargo-hack + - name: install cargo-minimal-versions + uses: taiki-e/install-action@cargo-minimal-versions + - name: Run tests + run: cargo minimal-versions test --all --all-targets --all-features + style: # Check style. needs: check @@ -75,7 +108,7 @@ jobs: with: command: fmt args: --all -- --check - + # warnings: # # Check for any warnings. This is informational and thus is allowed to fail. # runs-on: ubuntu-latest From b92d07420571ead9e56695cb7e0cbb1ecc88186a Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 17 Jun 2022 10:23:34 -0700 Subject: [PATCH 2/9] fixup! depend on correct jobs Signed-off-by: Eliza Weisman --- .github/workflows/CI.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 706cb6ef8..5061d4b35 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -72,7 +72,7 @@ jobs: test-versions: # Test against the stable, beta, and nightly Rust toolchains on ubuntu-latest. - needs: check + needs: check-stable runs-on: ubuntu-latest strategy: # Disable fail-fast. If the test run for a particular Rust version fails, @@ -96,7 +96,7 @@ jobs: args: --workspace --all-features test-msrv: - needs: check + needs: check-msrv runs-on: ubuntu-latest steps: - uses: actions/checkout@master @@ -113,7 +113,7 @@ jobs: run: cargo minimal-versions test --all --all-targets --all-features style: - needs: check + needs: check-stable runs-on: ubuntu-latest steps: - uses: actions/checkout@master From b7027182f83f57d699ff3ca012ff0591625d7273 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 17 Jun 2022 10:30:24 -0700 Subject: [PATCH 3/9] maybe this will work Signed-off-by: Eliza Weisman --- .github/workflows/CI.yml | 44 ++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5061d4b35..c60296707 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -49,12 +49,23 @@ jobs: with: toolchain: ${{ env.MSRV }} profile: minimal - - name: install cargo-hack - uses: taiki-e/install-action@cargo-hack - - name: install cargo-minimal-versions - uses: taiki-e/install-action@cargo-minimal-versions + - name: "install Rust nightly" + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + - name: Select minimal versions + uses: actions-rs/cargo@v1 + with: + command: update + args: -Z minimal-versions + toolchain: nightly - name: Check - run: cargo minimal-versions check --all --all-targets --all-features + uses: actions-rs/cargo@v1 + with: + command: check + args: --all --all-targets --all-features --locked + toolchain: ${{ env.MSRV }} cargo-hack: runs-on: ubuntu-latest @@ -105,12 +116,23 @@ jobs: with: toolchain: ${{ env.MSRV }} profile: minimal - - name: install cargo-hack - uses: taiki-e/install-action@cargo-hack - - name: install cargo-minimal-versions - uses: taiki-e/install-action@cargo-minimal-versions - - name: Run tests - run: cargo minimal-versions test --all --all-targets --all-features + - name: "install Rust nightly" + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + - name: Select minimal versions + uses: actions-rs/cargo@v1 + with: + command: update + args: -Z minimal-versions + toolchain: nightly + - name: test + uses: actions-rs/cargo@v1 + with: + command: check + args: --workspace --all-features --locked + toolchain: ${{ env.MSRV }} style: needs: check-stable From 213453ab2383e57c05dc6670ba6cf40cb2e64b25 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 17 Jun 2022 10:42:43 -0700 Subject: [PATCH 4/9] disable hdrhistogram's default features this fixes the minimal version build Signed-off-by: Eliza Weisman --- tower/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tower/Cargo.toml b/tower/Cargo.toml index f6407a4ea..a11015fa9 100644 --- a/tower/Cargo.toml +++ b/tower/Cargo.toml @@ -70,7 +70,7 @@ tower-service = { version = "0.3.1", path = "../tower-service" } futures-core = { version = "0.3", optional = true } futures-util = { version = "0.3", default-features = false, features = ["alloc"], optional = true } -hdrhistogram = { version = "7.0", optional = true } +hdrhistogram = { version = "7.0", optional = true, default-features = false } indexmap = { version = "1.0.2", optional = true } rand = { version = "0.8", features = ["small_rng"], optional = true } slab = { version = "0.4", optional = true } @@ -82,7 +82,7 @@ pin-project-lite = { version = "0.2.7", optional = true } [dev-dependencies] futures = "0.3" -hdrhistogram = "7.0" +hdrhistogram = { version = "7.0", default-features = false } pin-project-lite = "0.2.7" tokio = { version = "1.6", features = ["macros", "sync", "test-util", "rt-multi-thread"] } tokio-stream = "0.1" From c803a317f33c5f0ffa28e70edc3482f47b686614 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 17 Jun 2022 10:43:34 -0700 Subject: [PATCH 5/9] also let nightly cargo run the fetch Signed-off-by: Eliza Weisman --- .github/workflows/CI.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c60296707..15305ae9a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -60,11 +60,16 @@ jobs: command: update args: -Z minimal-versions toolchain: nightly + - name: cargo +nightly fetch + uses: actions-rs/cargo@v1 + with: + command: fetch + toolchain: nightly - name: Check uses: actions-rs/cargo@v1 with: command: check - args: --all --all-targets --all-features --locked + args: --all --all-targets --all-features --frozen toolchain: ${{ env.MSRV }} cargo-hack: @@ -127,6 +132,11 @@ jobs: command: update args: -Z minimal-versions toolchain: nightly + - name: cargo +nightly fetch + uses: actions-rs/cargo@v1 + with: + command: fetch + toolchain: nightly - name: test uses: actions-rs/cargo@v1 with: From a1e52a4863480406a13a5ff3c7d207fe51fd2723 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 17 Jun 2022 10:46:36 -0700 Subject: [PATCH 6/9] let msrv cargo fetch deps Signed-off-by: Eliza Weisman --- .github/workflows/CI.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 15305ae9a..c60296707 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -60,16 +60,11 @@ jobs: command: update args: -Z minimal-versions toolchain: nightly - - name: cargo +nightly fetch - uses: actions-rs/cargo@v1 - with: - command: fetch - toolchain: nightly - name: Check uses: actions-rs/cargo@v1 with: command: check - args: --all --all-targets --all-features --frozen + args: --all --all-targets --all-features --locked toolchain: ${{ env.MSRV }} cargo-hack: @@ -132,11 +127,6 @@ jobs: command: update args: -Z minimal-versions toolchain: nightly - - name: cargo +nightly fetch - uses: actions-rs/cargo@v1 - with: - command: fetch - toolchain: nightly - name: test uses: actions-rs/cargo@v1 with: From 617f183b4558262491fc16a8dd0c4d1b9cd9f0f2 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 17 Jun 2022 11:03:30 -0700 Subject: [PATCH 7/9] use tracing-subscriber 0.3 in tests Signed-off-by: Eliza Weisman --- tower/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tower/Cargo.toml b/tower/Cargo.toml index a11015fa9..db003f4ba 100644 --- a/tower/Cargo.toml +++ b/tower/Cargo.toml @@ -88,7 +88,7 @@ tokio = { version = "1.6", features = ["macros", "sync", "test-util", "rt-multi- tokio-stream = "0.1" tokio-test = "0.4" tower-test = { version = "0.4", path = "../tower-test" } -tracing-subscriber = "0.2.14" +tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "ansi"] } http = "0.2" [package.metadata.docs.rs] From 669ba181afdc302620d32de1aec0e03ed66c6ecc Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 17 Jun 2022 11:14:57 -0700 Subject: [PATCH 8/9] tests fail on tokio 1.6.1 due to timer bug see https://github.com/tokio-rs/tokio/blob/master/tokio/CHANGELOG.md#162-june-14-2021 Signed-off-by: Eliza Weisman --- tower/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tower/Cargo.toml b/tower/Cargo.toml index db003f4ba..cb1ccb317 100644 --- a/tower/Cargo.toml +++ b/tower/Cargo.toml @@ -84,7 +84,7 @@ pin-project-lite = { version = "0.2.7", optional = true } futures = "0.3" hdrhistogram = { version = "7.0", default-features = false } pin-project-lite = "0.2.7" -tokio = { version = "1.6", features = ["macros", "sync", "test-util", "rt-multi-thread"] } +tokio = { version = "1.6.2", features = ["macros", "sync", "test-util", "rt-multi-thread"] } tokio-stream = "0.1" tokio-test = "0.4" tower-test = { version = "0.4", path = "../tower-test" } From 2a0e58676d1307a7c1180d58e48f4a7676199866 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 17 Jun 2022 11:15:24 -0700 Subject: [PATCH 9/9] explicitly use a non-messed-up lazy-static dev dep i hate this but whatever lol Signed-off-by: Eliza Weisman --- tower/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/tower/Cargo.toml b/tower/Cargo.toml index cb1ccb317..f80b7b1fb 100644 --- a/tower/Cargo.toml +++ b/tower/Cargo.toml @@ -90,6 +90,7 @@ tokio-test = "0.4" tower-test = { version = "0.4", path = "../tower-test" } tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "ansi"] } http = "0.2" +lazy_static = "1.4.0" [package.metadata.docs.rs] all-features = true