From f6b1d35c516fd89e1acfd0b5febe9da5feb394e7 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Mon, 27 Jun 2022 20:44:20 +0200 Subject: [PATCH] Use minimal dependency versions for MSRV tests on CI (#1109) --- .github/workflows/CI.yml | 29 +++++++++++++++++++++++----- Cargo.toml | 5 +++++ axum-macros/Cargo.toml | 2 +- axum/Cargo.toml | 4 ++-- internal-minimal-versions/Cargo.toml | 16 +++++++++++++++ internal-minimal-versions/src/lib.rs | 1 + 6 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 internal-minimal-versions/Cargo.toml create mode 100644 internal-minimal-versions/src/lib.rs diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9665d0fd..11472058 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -2,6 +2,7 @@ name: CI env: CARGO_TERM_COLOR: always + MSRV: 1.56.0 on: push: @@ -88,8 +89,8 @@ jobs: command: test args: --all --all-features --all-targets - # some examples doesn't support 1.56 (such as async-graphql) - # so we only test axum itself on 1.56 + # some examples doesn't support our MSRV (such as async-graphql) + # so we only test axum itself on our MSRV test-msrv: needs: check runs-on: ubuntu-latest @@ -97,10 +98,21 @@ jobs: - uses: actions/checkout@master - uses: actions-rs/toolchain@v1 with: - toolchain: 1.56 + toolchain: ${{ env.MSRV }} override: true profile: minimal + - name: "install Rust nightly" + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal - uses: Swatinem/rust-cache@v1 + - name: Select minimal versions + uses: actions-rs/cargo@v1 + with: + command: update + args: -Z minimal-versions + toolchain: nightly - name: Run tests uses: actions-rs/cargo@v1 with: @@ -109,8 +121,12 @@ jobs: -p axum -p axum-extra -p axum-core - --all-features --all-targets - # the compiler errors are different on 1.56 which makes + -p internal-minimal-versions + --all-features + --all-targets + --locked + toolchain: ${{ env.MSRV }} + # the compiler errors are different on our MSRV which makes # the trybuild tests in axum-macros fail, so just run the doc # tests - name: Run axum-macros doc tests @@ -119,8 +135,11 @@ jobs: command: test args: > -p axum-macros + -p internal-minimal-versions --doc --all-features + --locked + toolchain: ${{ env.MSRV }} test-docs: needs: check diff --git a/Cargo.toml b/Cargo.toml index 51b1cc39..a221fbc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,4 +4,9 @@ members = [ "axum-core", "axum-extra", "axum-macros", + + # internal crate used to bump the minimum versions we + # get for some dependencies which otherwise wouldn't build + # with `cargo +nightly update -Z minimal-versions` + "internal-minimal-versions", ] diff --git a/axum-macros/Cargo.toml b/axum-macros/Cargo.toml index b6c9d887..5a27b31c 100644 --- a/axum-macros/Cargo.toml +++ b/axum-macros/Cargo.toml @@ -26,4 +26,4 @@ rustversion = "1.0" serde = { version = "1.0", features = ["derive"] } syn = { version = "1.0", features = ["full", "extra-traits"] } tokio = { version = "1.0", features = ["full"] } -trybuild = "1.0" +trybuild = "1.0.63" diff --git a/axum/Cargo.toml b/axum/Cargo.toml index 40c5ad16..6dae352b 100644 --- a/axum/Cargo.toml +++ b/axum/Cargo.toml @@ -48,7 +48,7 @@ tower-service = "0.3" # optional dependencies base64 = { version = "0.13", optional = true } -headers = { version = "0.3", optional = true } +headers = { version = "0.3.7", optional = true } multer = { version = "2.0.0", optional = true } serde_json = { version = "1.0", features = ["raw_value"], optional = true } serde_urlencoded = { version = "0.7", optional = true } @@ -60,7 +60,7 @@ anyhow = "1.0" futures = "0.3" quickcheck = "1.0" quickcheck_macros = "1.0" -reqwest = { version = "0.11", default-features = false, features = ["json", "stream", "multipart"] } +reqwest = { version = "0.11.11", default-features = false, features = ["json", "stream", "multipart"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tokio = { version = "1.6.1", features = ["macros", "rt", "rt-multi-thread", "net", "test-util"] } diff --git a/internal-minimal-versions/Cargo.toml b/internal-minimal-versions/Cargo.toml new file mode 100644 index 00000000..9e2a69c7 --- /dev/null +++ b/internal-minimal-versions/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "internal-minimal-versions" +version = "0.1.0" +edition = "2021" +publish = false + +# these dependencies don't build if installed with `cargo +nightly update -Z +# minimal-versions` so we add them here to make sure we get a version that +# does build +# +# this only matters for axum's CI +[dependencies] +crc32fast = "1.3.2" +gcc = "0.3.55" +time = "0.3.9" +tungstenite = "0.17.2" diff --git a/internal-minimal-versions/src/lib.rs b/internal-minimal-versions/src/lib.rs new file mode 100644 index 00000000..36db4933 --- /dev/null +++ b/internal-minimal-versions/src/lib.rs @@ -0,0 +1 @@ +// intentionally left empty