Skip to content

Commit 6a042a9

Browse files
authored
Cleanup CI (#141)
* Feature-gate test that depends on non-default features Makes `cargo check` work without extra flags. * Don't set doc(html_root_url) It is no longer recommended: rust-lang/api-guidelines#230 * Remove documentation URL from Cargo.toml crates.io will link to the right version on docs.rs automatically. * Ensure toolchains installed by actions-rs/toolchain are actually used * Fix missing rustup component in check job * Raise MSRV to 1.51 Older versions weren't actually working before. * Only run clippy & rustfmt on stable toolchain MSRV is checked in test-versions. * Allow cargo doc to succeed without headers and multipart features CI will still ensure that intra-doc links that rely on these are not broken.
1 parent e13f1da commit 6a042a9

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

.github/workflows/CI.yml

+9-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ jobs:
1010
check:
1111
# Run `cargo check` first to ensure that the pushed code at least compiles.
1212
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
rust: [stable, 1.40.0]
1613
steps:
1714
- uses: actions/checkout@master
1815
- uses: actions-rs/toolchain@v1
1916
with:
20-
toolchain: ${{ matrix.rust }}
17+
toolchain: stable
18+
override: true
2119
profile: minimal
20+
components: clippy
2221
- name: Check
2322
uses: actions-rs/cargo@v1
2423
with:
@@ -37,9 +36,12 @@ jobs:
3736
- uses: actions-rs/toolchain@v1
3837
with:
3938
toolchain: stable
39+
override: true
4040
profile: minimal
4141
- name: cargo doc
4242
working-directory: ${{ matrix.subcrate }}
43+
env:
44+
RUSTDOCFLAGS: "-D broken-intra-doc-links"
4345
run: cargo doc --all-features --no-deps
4446

4547
cargo-hack:
@@ -49,6 +51,7 @@ jobs:
4951
- uses: actions-rs/toolchain@v1
5052
with:
5153
toolchain: stable
54+
override: true
5255
profile: minimal
5356
- name: Install cargo-hack
5457
run: |
@@ -63,12 +66,13 @@ jobs:
6366
runs-on: ubuntu-latest
6467
strategy:
6568
matrix:
66-
rust: [stable, beta, nightly, 1.40.0]
69+
rust: [stable, beta, nightly, 1.51]
6770
steps:
6871
- uses: actions/checkout@master
6972
- uses: actions-rs/toolchain@v1
7073
with:
7174
toolchain: ${{ matrix.rust }}
75+
override: true
7276
profile: minimal
7377
- name: Run tests
7478
uses: actions-rs/cargo@v1

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
authors = ["David Pedersen <[email protected]>"]
33
categories = ["asynchronous", "network-programming", "web-programming"]
44
description = "Web framework that focuses on ergonomics and modularity"
5-
documentation = "https://docs.rs/axum/0.1.3"
65
edition = "2018"
76
homepage = "https://github.com/tokio-rs/axum"
87
keywords = ["http", "web", "framework"]

src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,6 @@
664664
//! [examples]: https://github.com/tokio-rs/axum/tree/main/examples
665665
//! [`axum::Server`]: hyper::server::Server
666666
667-
#![doc(html_root_url = "https://docs.rs/axum/0.1.3")]
668667
#![warn(
669668
clippy::all,
670669
clippy::dbg_macro,
@@ -699,7 +698,7 @@
699698
missing_debug_implementations,
700699
missing_docs
701700
)]
702-
#![deny(unreachable_pub, broken_intra_doc_links, private_in_public)]
701+
#![deny(unreachable_pub, private_in_public)]
703702
#![allow(elided_lifetimes_in_paths, clippy::type_complexity)]
704703
#![forbid(unsafe_code)]
705704
#![cfg_attr(docsrs, feature(doc_cfg))]

src/tests.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::{
2-
extract::RequestParts, handler::on, prelude::*, response::IntoResponse, routing::nest,
3-
routing::MethodFilter, service,
2+
extract::RequestParts, handler::on, prelude::*, routing::nest, routing::MethodFilter, service,
43
};
54
use bytes::Bytes;
65
use futures_util::future::Ready;
@@ -514,8 +513,10 @@ async fn layer_on_whole_router() {
514513
}
515514

516515
#[tokio::test]
516+
#[cfg(feature = "header")]
517517
async fn typed_header() {
518-
use extract::TypedHeader;
518+
use crate::{extract::TypedHeader, response::IntoResponse};
519+
519520
async fn handle(TypedHeader(user_agent): TypedHeader<headers::UserAgent>) -> impl IntoResponse {
520521
user_agent.to_string()
521522
}

0 commit comments

Comments
 (0)