mirror of
https://github.com/actix/actix-web.git
synced 2024-12-17 13:46:36 +00:00
Merge branch 'master' into fix-compression-middleware-images
This commit is contained in:
commit
2b543437c3
7 changed files with 109 additions and 83 deletions
6
.github/workflows/bench.yml
vendored
6
.github/workflows/bench.yml
vendored
|
@ -6,7 +6,11 @@ on:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read # to fetch code (actions/checkout)
|
contents: read # to fetch code (actions/checkout)
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_benchmark:
|
check_benchmark:
|
||||||
|
|
10
.github/workflows/ci-post-merge.yml
vendored
10
.github/workflows/ci-post-merge.yml
vendored
|
@ -5,7 +5,11 @@ on:
|
||||||
branches: [master]
|
branches: [master]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read # to fetch code (actions/checkout)
|
contents: read # to fetch code (actions/checkout)
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_test_nightly:
|
build_and_test_nightly:
|
||||||
|
@ -44,7 +48,7 @@ jobs:
|
||||||
- name: Install ${{ matrix.version }}
|
- name: Install ${{ matrix.version }}
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.version }}-${{ matrix.target.triple }}
|
toolchain: ${{ matrix.version }}
|
||||||
profile: minimal
|
profile: minimal
|
||||||
override: true
|
override: true
|
||||||
|
|
||||||
|
@ -81,7 +85,7 @@ jobs:
|
||||||
|
|
||||||
- name: Clear the cargo caches
|
- name: Clear the cargo caches
|
||||||
run: |
|
run: |
|
||||||
cargo install cargo-cache --version 0.8.2 --no-default-features --features ci-autoclean
|
cargo install cargo-cache --version 0.8.3 --no-default-features --features ci-autoclean
|
||||||
cargo-cache
|
cargo-cache
|
||||||
|
|
||||||
ci_feature_powerset_check:
|
ci_feature_powerset_check:
|
||||||
|
|
64
.github/workflows/ci.yml
vendored
64
.github/workflows/ci.yml
vendored
|
@ -9,6 +9,10 @@ on:
|
||||||
permissions:
|
permissions:
|
||||||
contents: read # to fetch code (actions/checkout)
|
contents: read # to fetch code (actions/checkout)
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_test:
|
build_and_test:
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -17,7 +21,7 @@ jobs:
|
||||||
target:
|
target:
|
||||||
- { name: Linux, os: ubuntu-latest, triple: x86_64-unknown-linux-gnu }
|
- { name: Linux, os: ubuntu-latest, triple: x86_64-unknown-linux-gnu }
|
||||||
- { name: macOS, os: macos-latest, triple: x86_64-apple-darwin }
|
- { name: macOS, os: macos-latest, triple: x86_64-apple-darwin }
|
||||||
- { name: Windows, os: windows-2022, triple: x86_64-pc-windows-msvc }
|
- { name: Windows, os: windows-latest, triple: x86_64-pc-windows-msvc }
|
||||||
version:
|
version:
|
||||||
- 1.59.0 # MSRV
|
- 1.59.0 # MSRV
|
||||||
- stable
|
- stable
|
||||||
|
@ -25,30 +29,22 @@ jobs:
|
||||||
name: ${{ matrix.target.name }} / ${{ matrix.version }}
|
name: ${{ matrix.target.name }} / ${{ matrix.version }}
|
||||||
runs-on: ${{ matrix.target.os }}
|
runs-on: ${{ matrix.target.os }}
|
||||||
|
|
||||||
env:
|
env: {}
|
||||||
CI: 1
|
|
||||||
CARGO_INCREMENTAL: 0
|
|
||||||
VCPKGRS_DYNAMIC: 1
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
# install OpenSSL on Windows
|
|
||||||
# TODO: GitHub actions docs state that OpenSSL is
|
|
||||||
# already installed on these Windows machines somewhere
|
|
||||||
- name: Set vcpkg root
|
|
||||||
if: matrix.target.triple == 'x86_64-pc-windows-msvc'
|
|
||||||
run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
|
|
||||||
- name: Install OpenSSL
|
- name: Install OpenSSL
|
||||||
if: matrix.target.triple == 'x86_64-pc-windows-msvc'
|
if: matrix.target.os == 'windows-latest'
|
||||||
run: vcpkg install openssl:x64-windows
|
run: choco install openssl
|
||||||
|
- name: Set OpenSSL dir in env
|
||||||
|
if: matrix.target.os == 'windows-latest'
|
||||||
|
run: echo 'OPENSSL_DIR=C:\Program Files\OpenSSL-Win64' | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||||
|
|
||||||
- name: Install ${{ matrix.version }}
|
- name: Install Rust (${{ matrix.version }})
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.version }}-${{ matrix.target.triple }}
|
toolchain: ${{ matrix.version }}
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Install cargo-hack
|
- name: Install cargo-hack
|
||||||
uses: taiki-e/install-action@cargo-hack
|
uses: taiki-e/install-action@cargo-hack
|
||||||
|
@ -60,12 +56,6 @@ jobs:
|
||||||
cargo add const-str@0.3 --dev -p=actix-web
|
cargo add const-str@0.3 --dev -p=actix-web
|
||||||
cargo add const-str@0.3 --dev -p=awc
|
cargo add const-str@0.3 --dev -p=awc
|
||||||
|
|
||||||
- name: Generate Cargo.lock
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with: { command: generate-lockfile }
|
|
||||||
- name: Cache Dependencies
|
|
||||||
uses: Swatinem/rust-cache@v1.2.0
|
|
||||||
|
|
||||||
- name: workaround MSRV issues
|
- name: workaround MSRV issues
|
||||||
if: matrix.version != 'stable'
|
if: matrix.version != 'stable'
|
||||||
run: |
|
run: |
|
||||||
|
@ -95,7 +85,7 @@ jobs:
|
||||||
|
|
||||||
- name: Clear the cargo caches
|
- name: Clear the cargo caches
|
||||||
run: |
|
run: |
|
||||||
cargo install cargo-cache --version 0.8.2 --no-default-features --features ci-autoclean
|
cargo install cargo-cache --version 0.8.3 --no-default-features --features ci-autoclean
|
||||||
cargo-cache
|
cargo-cache
|
||||||
|
|
||||||
io-uring:
|
io-uring:
|
||||||
|
@ -104,20 +94,15 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- name: Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
- name: Generate Cargo.lock
|
with: { toolchain: nightly }
|
||||||
run: cargo generate-lockfile
|
|
||||||
- name: Cache Dependencies
|
|
||||||
uses: Swatinem/rust-cache@v1.3.0
|
|
||||||
|
|
||||||
- name: tests (io-uring)
|
- name: tests (io-uring)
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
run: >
|
run: >
|
||||||
sudo bash -c "ulimit -Sl 512
|
sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=stable cargo test --lib --tests -p=actix-files --all-features"
|
||||||
&& ulimit -Hl 512
|
|
||||||
&& PATH=$PATH:/usr/share/rust/.cargo/bin
|
|
||||||
&& RUSTUP_TOOLCHAIN=stable cargo test --lib --tests -p=actix-files --all-features"
|
|
||||||
|
|
||||||
rustdoc:
|
rustdoc:
|
||||||
name: doc tests
|
name: doc tests
|
||||||
|
@ -125,12 +110,9 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- name: Install Rust (nightly)
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
- name: Generate Cargo.lock
|
with: { toolchain: nightly }
|
||||||
run: cargo generate-lockfile
|
|
||||||
- name: Cache Dependencies
|
|
||||||
uses: Swatinem/rust-cache@v1.3.0
|
|
||||||
|
|
||||||
- name: doc tests
|
- name: doc tests
|
||||||
run: cargo ci-doctest
|
run: cargo ci-doctest
|
||||||
|
|
62
.github/workflows/clippy-fmt.yml
vendored
62
.github/workflows/clippy-fmt.yml
vendored
|
@ -4,46 +4,72 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read # to fetch code (actions/checkout)
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
fmt:
|
fmt:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
|
||||||
with: { components: rustfmt }
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: nightly
|
||||||
|
components: rustfmt
|
||||||
|
|
||||||
- run: cargo fmt --all -- --check
|
- run: cargo fmt --all -- --check
|
||||||
|
|
||||||
clippy:
|
clippy:
|
||||||
|
permissions:
|
||||||
|
checks: write # to add clippy checks to PR diffs
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with: { components: clippy }
|
with: { components: clippy }
|
||||||
|
|
||||||
- name: Generate Cargo.lock
|
- uses: giraffate/clippy-action@v1
|
||||||
run: cargo generate-lockfile
|
|
||||||
- name: Cache Dependencies
|
|
||||||
uses: Swatinem/rust-cache@v1.2.0
|
|
||||||
|
|
||||||
- name: Check with Clippy
|
|
||||||
uses: actions-rs/clippy-check@v1
|
|
||||||
with:
|
with:
|
||||||
args: --workspace --tests --examples --all-features
|
reporter: 'github-pr-check'
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
clippy_flags: --workspace --all-features --tests --examples --bins -- -Dclippy::todo
|
||||||
|
|
||||||
lint-docs:
|
lint-docs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with: { components: rust-docs }
|
with: { components: rust-docs }
|
||||||
|
|
||||||
- name: Check for broken intra-doc links
|
- name: Check for broken intra-doc links
|
||||||
uses: actions-rs/cargo@v1
|
env: { RUSTDOCFLAGS: "-D warnings" }
|
||||||
env:
|
run: cargo doc --no-deps --all-features --workspace
|
||||||
RUSTDOCFLAGS: "-D warnings"
|
|
||||||
|
public-api-diff:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
command: doc
|
ref: ${{ github.base_ref }}
|
||||||
args: --no-deps --all-features --workspace
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with: { toolchain: nightly }
|
||||||
|
|
||||||
|
- uses: taiki-e/cache-cargo-install-action@v1
|
||||||
|
with: { tool: cargo-public-api }
|
||||||
|
|
||||||
|
- name: generate API diff
|
||||||
|
run: |
|
||||||
|
for f in $(find -mindepth 2 -maxdepth 2 -name Cargo.toml); do
|
||||||
|
cargo public-api --manifest-path "$f" diff ${{ github.event.pull_request.base.sha }}..${{ github.sha }}
|
||||||
|
done
|
||||||
|
|
21
.github/workflows/coverage.yml
vendored
21
.github/workflows/coverage.yml
vendored
|
@ -6,6 +6,13 @@ on:
|
||||||
push:
|
push:
|
||||||
branches: [master]
|
branches: [master]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read # to fetch code (actions/checkout)
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# job currently (1st Feb 2022) segfaults
|
# job currently (1st Feb 2022) segfaults
|
||||||
coverage:
|
coverage:
|
||||||
|
@ -14,18 +21,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install stable
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
uses: actions-rs/toolchain@v1
|
with: { toolchain: nightly }
|
||||||
with:
|
|
||||||
toolchain: stable-x86_64-unknown-linux-gnu
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Generate Cargo.lock
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with: { command: generate-lockfile }
|
|
||||||
- name: Cache Dependencies
|
|
||||||
uses: Swatinem/rust-cache@v1.2.0
|
|
||||||
|
|
||||||
- name: Generate coverage file
|
- name: Generate coverage file
|
||||||
run: |
|
run: |
|
||||||
|
|
10
.github/workflows/upload-doc.yml
vendored
10
.github/workflows/upload-doc.yml
vendored
|
@ -4,11 +4,17 @@ on:
|
||||||
push:
|
push:
|
||||||
branches: [master]
|
branches: [master]
|
||||||
|
|
||||||
permissions: {}
|
permissions:
|
||||||
|
contents: read # to fetch code (actions/checkout)
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # to push changes in repo (jamesives/github-pages-deploy-action)
|
contents: write # to push changes in repo (jamesives/github-pages-deploy-action)
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,9 @@ use tokio::sync::mpsc;
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// use actix_http::HttpService;
|
/// use actix_http::HttpService;
|
||||||
/// use actix_http_test::test_server;
|
/// use actix_http_test::test_server;
|
||||||
/// use actix_web::{web, App, HttpResponse, Error};
|
/// use actix_service::map_config;
|
||||||
|
/// use actix_service::ServiceFactoryExt;
|
||||||
|
/// use actix_web::{dev::AppConfig, web, App, Error, HttpResponse};
|
||||||
///
|
///
|
||||||
/// async fn my_handler() -> Result<HttpResponse, Error> {
|
/// async fn my_handler() -> Result<HttpResponse, Error> {
|
||||||
/// Ok(HttpResponse::Ok().into())
|
/// Ok(HttpResponse::Ok().into())
|
||||||
|
@ -42,14 +44,19 @@ use tokio::sync::mpsc;
|
||||||
///
|
///
|
||||||
/// #[actix_web::test]
|
/// #[actix_web::test]
|
||||||
/// async fn test_example() {
|
/// async fn test_example() {
|
||||||
/// let mut srv = TestServer::start(||
|
/// let srv = test_server(|| {
|
||||||
/// HttpService::new(
|
/// let app = App::new().service(web::resource("/").to(my_handler));
|
||||||
/// App::new().service(web::resource("/").to(my_handler))
|
///
|
||||||
/// )
|
/// HttpService::build()
|
||||||
/// );
|
/// .h1(map_config(app, |_| AppConfig::default()))
|
||||||
|
/// .tcp()
|
||||||
|
/// .map_err(|_| ())
|
||||||
|
/// })
|
||||||
|
/// .await;
|
||||||
///
|
///
|
||||||
/// let req = srv.get("/");
|
/// let req = srv.get("/");
|
||||||
/// let response = req.send().await.unwrap();
|
/// let response = req.send().await.unwrap();
|
||||||
|
///
|
||||||
/// assert!(response.status().is_success());
|
/// assert!(response.status().is_success());
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
Loading…
Reference in a new issue