Skip to content

Commit

Permalink
Cleanup CI (#141)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
jplatte authored Aug 7, 2021
1 parent e13f1da commit 6a042a9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ jobs:
check:
# 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
override: true
profile: minimal
components: clippy
- name: Check
uses: actions-rs/cargo@v1
with:
Expand All @@ -37,9 +36,12 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: cargo doc
working-directory: ${{ matrix.subcrate }}
env:
RUSTDOCFLAGS: "-D broken-intra-doc-links"
run: cargo doc --all-features --no-deps

cargo-hack:
Expand All @@ -49,6 +51,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Install cargo-hack
run: |
Expand All @@ -63,12 +66,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, beta, nightly, 1.40.0]
rust: [stable, beta, nightly, 1.51]
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
profile: minimal
- name: Run tests
uses: actions-rs/cargo@v1
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
authors = ["David Pedersen <david.pdrsn@gmail.com>"]
categories = ["asynchronous", "network-programming", "web-programming"]
description = "Web framework that focuses on ergonomics and modularity"
documentation = "https://docs.rs/axum/0.1.3"
edition = "2018"
homepage = "https://github.com/tokio-rs/axum"
keywords = ["http", "web", "framework"]
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,6 @@
//! [examples]: https://github.com/tokio-rs/axum/tree/main/examples
//! [`axum::Server`]: hyper::server::Server

#![doc(html_root_url = "https://docs.rs/axum/0.1.3")]
#![warn(
clippy::all,
clippy::dbg_macro,
Expand Down Expand Up @@ -699,7 +698,7 @@
missing_debug_implementations,
missing_docs
)]
#![deny(unreachable_pub, broken_intra_doc_links, private_in_public)]
#![deny(unreachable_pub, private_in_public)]
#![allow(elided_lifetimes_in_paths, clippy::type_complexity)]
#![forbid(unsafe_code)]
#![cfg_attr(docsrs, feature(doc_cfg))]
Expand Down
7 changes: 4 additions & 3 deletions src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::{
extract::RequestParts, handler::on, prelude::*, response::IntoResponse, routing::nest,
routing::MethodFilter, service,
extract::RequestParts, handler::on, prelude::*, routing::nest, routing::MethodFilter, service,
};
use bytes::Bytes;
use futures_util::future::Ready;
Expand Down Expand Up @@ -514,8 +513,10 @@ async fn layer_on_whole_router() {
}

#[tokio::test]
#[cfg(feature = "header")]
async fn typed_header() {
use extract::TypedHeader;
use crate::{extract::TypedHeader, response::IntoResponse};

async fn handle(TypedHeader(user_agent): TypedHeader<headers::UserAgent>) -> impl IntoResponse {
user_agent.to_string()
}
Expand Down

0 comments on commit 6a042a9

Please sign in to comment.