Split examples & check minimum versions (#3370)

Currently, both cargo deny and our MSRV checks use Cargo.lock file which has unified features and versions across both the axum crates and all the examples. This can hide some issues as usually when someone adds an example, they might use cargo add which will silently update the dependency for the whole repository. Some compilation errors (like axum requiring bytes@1.0 while it uses features from bytes@1.7) will then be hidden.

I don't think most users would ever need to use the minimal versions anyway so this is not as severe, but someone might run into compilation errors.
This commit is contained in:
David Mládek 2025-12-02 22:24:37 +01:00 committed by GitHub
parent aeff16e91a
commit b9e35ec780
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 5964 additions and 3672 deletions

View File

@ -24,6 +24,8 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Check
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Check
run: cargo clippy --manifest-path examples/Cargo.toml --workspace --all-targets --all-features -- -D warnings
- name: rustfmt
run: cargo fmt --all --check
@ -92,6 +94,8 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Run tests
run: cargo test --workspace --all-features --all-targets
- name: Test examples
run: cargo test --manifest-path examples/Cargo.toml --workspace --all-features --all-targets
# some examples don't support our MSRV so we only test axum itself on our MSRV
test-nightly:
@ -129,8 +133,12 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Select minimal version
run: cargo +nightly update -Z minimal-versions
- name: Fix up Cargo.lock
- name: Fix up Cargo.lock - crc32fast
run: cargo +nightly update -p crc32fast --precise 1.1.1
- name: Fix up Cargo.lock - version_check
run : cargo +nightly update -p version_check@0.1.0 --precise 0.1.4
- name: Fix up Cargo.lock - lazy_static
run: cargo +nightly update -p lazy_static --precise 1.1.0
- name: Run tests
run: >
cargo +${{ env.MSRV }}

3714
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,5 @@
[workspace]
members = ["axum", "axum-*", "examples/*"]
# Only check / build main crates by default (check all with `--workspace`)
default-members = ["axum", "axum-*"]
# Example has been deleted, but README.md remains
exclude = ["examples/async-graphql"]
members = ["axum", "axum-*"]
resolver = "2"
[workspace.package]

View File

@ -150,7 +150,7 @@ tempfile = "3.23.0"
tokio = { version = "1.14", features = ["full"] }
tower = { version = "0.5.2", features = ["util"] }
tower-http = { version = "0.6.0", features = ["map-response-body", "timeout"] }
tracing-subscriber = "0.3.19"
tracing-subscriber = "0.3.20"
[lints]
workspace = true

View File

@ -118,8 +118,8 @@ axum-macros = { path = "../axum-macros", version = "0.5.0", optional = true }
base64 = { version = "0.22.1", optional = true }
form_urlencoded = { version = "1.1.0", optional = true }
futures-sink = { version = "0.3", optional = true }
hyper = { version = "1.1.0", optional = true }
hyper-util = { version = "0.1.3", features = ["tokio", "server", "service"], optional = true }
hyper = { version = "1.4.0", optional = true }
hyper-util = { version = "0.1.4", features = ["tokio", "server", "service"], optional = true }
multer = { version = "3.0.0", optional = true }
reqwest = { version = "0.12", optional = true, default-features = false, features = ["json", "stream", "multipart"] }
serde_json = { version = "1.0", features = ["raw_value"], optional = true }
@ -183,7 +183,7 @@ tokio = { package = "tokio", version = "1.44.2", features = ["macros", "rt", "rt
tokio-stream = "0.1"
tokio-tungstenite = "0.28.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["json"] }
tracing-subscriber = { version = "0.3.20", features = ["json"] }
uuid = { version = "1.0", features = ["serde", "v4"] }
[dev-dependencies.tower]

5852
examples/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

46
examples/Cargo.toml Normal file
View File

@ -0,0 +1,46 @@
[workspace]
members = ["*"]
# Example has been deleted, but README.md remains
exclude = ["async-graphql", "target"]
resolver = "2"
[workspace.package]
rust-version = "1.75"
[workspace.lints.rust]
unsafe_code = "forbid"
rust_2018_idioms = { level = "warn", priority = -1 }
missing_debug_implementations = "warn"
missing_docs = "warn"
unreachable_pub = "warn"
[workspace.lints.clippy]
type_complexity = "allow"
await_holding_lock = "warn"
dbg_macro = "warn"
empty_enum = "warn"
enum_glob_use = "warn"
exit = "warn"
filter_map_next = "warn"
fn_params_excessive_bools = "warn"
if_let_mutex = "warn"
imprecise_flops = "warn"
inefficient_to_string = "warn"
linkedlist = "warn"
lossy_float_literal = "warn"
macro_use_imports = "warn"
match_wildcard_for_single_variants = "warn"
mem_forget = "warn"
needless_borrow = "warn"
needless_continue = "warn"
option_option = "warn"
rest_pat_in_fully_bound_structs = "warn"
str_to_string = "warn"
suboptimal_flops = "warn"
todo = "warn"
uninlined_format_args = "warn"
unnested_or_patterns = "warn"
unused_self = "warn"
verbose_file_reads = "warn"