1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 17:22:57 +01:00

Merge pull request #2 from actix/setup-ci

Setup GitHub Actions
This commit is contained in:
Yuki Okushi 2020-01-30 23:14:21 +09:00 committed by GitHub
commit e68ec39bd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 340 additions and 324 deletions

18
.github/workflows/clippy.yml vendored Normal file
View File

@ -0,0 +1,18 @@
on: pull_request
name: Clippy Check
jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all --tests

83
.github/workflows/linux.yml vendored Normal file
View File

@ -0,0 +1,83 @@
name: CI (Linux)
on: [push, pull_request]
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
version:
- stable
- nightly
name: ${{ matrix.version }} - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
services:
redis:
image: redis:5.0.7
ports:
- 6379:6379
options: --entrypoint redis-server
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ matrix.version }}-x86_64-unknown-linux-gnu-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ matrix.version }}-x86_64-unknown-linux-gnu-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ matrix.version }}-x86_64-unknown-linux-gnu-cargo-build-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: check build
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests
- name: tests
uses: actions-rs/cargo@v1
timeout-minutes: 40
with:
command: test
args: --all --all-features --no-fail-fast -- --nocapture
- name: Generate coverage file
if: matrix.version == 'stable' && (github.ref == 'master' || github.event_name == 'pull_request')
run: |
cargo install cargo-tarpaulin
cargo tarpaulin --out Xml --workspace --all-features
- name: Upload to Codecov
if: matrix.version == 'stable' && (github.ref == 'master' || github.event_name == 'pull_request')
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: cobertura.xml
- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache

66
.github/workflows/macos.yml vendored Normal file
View File

@ -0,0 +1,66 @@
name: CI (macOS)
on: [push, pull_request]
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
version:
- stable
- nightly
name: ${{ matrix.version }} - x86_64-apple-darwin
runs-on: macos-latest
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-x86_64-apple-darwin
profile: minimal
override: true
- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ matrix.version }}-x86_64-apple-darwin-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ matrix.version }}-x86_64-apple-darwin-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ matrix.version }}-x86_64-apple-darwin-cargo-build-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: check build
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests
- name: tests
uses: actions-rs/cargo@v1
timeout-minutes: 40
with:
command: test
args: --package=actix-cors
--package=actix-protobuf
--package=actix-web-httpauth
--all-features --no-fail-fast -- --nocapture
- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache

43
.github/workflows/msrv.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: CI (Linux, MSRV)
on: [push, pull_request]
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
version:
- 1.39.0
name: ${{ matrix.version }} - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
services:
redis:
image: redis:5.0.7
ports:
- 6379:6379
options: --entrypoint redis-server
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: tests (1.39.0)
if: matrix.version == '1.39.0'
uses: actions-rs/cargo@v1
timeout-minutes: 40
with:
command: test
args: --package=actix-cors
--package=actix-protobuf
--package=actix-redis
--package=actix-web-httpauth
--all-features --no-fail-fast -- --nocapture

35
.github/workflows/upload-doc.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Upload documentation (actix-redis)
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'actix/actix-extras'
steps:
- uses: actions/checkout@master
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: check build
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --package=actix-redis
- name: Tweak HTML
run: echo "<meta http-equiv=refresh content=0;url=os_balloon/index.html>" > target/doc/index.html
- name: Upload documentation
run: |
git clone https://github.com/davisp/ghp-import.git
./ghp-import/ghp_import.py -n -p -f -m "Documentation upload" -r https://${{ secrets.GITHUB_TOKEN }}@github.com/"${{ github.repository }}.git" target/doc

70
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,70 @@
name: CI (Windows)
on: [push, pull_request]
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
version:
- stable
- nightly
target:
- x86_64-pc-windows-msvc
- x86_64-pc-windows-gnu
- i686-pc-windows-msvc
name: ${{ matrix.version }} - ${{ matrix.target }}
runs-on: windows-latest
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-${{ matrix.target }}
profile: minimal
override: true
- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ matrix.version }}-${{ matrix.target }}-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ matrix.version }}-${{ matrix.target }}-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ matrix.version }}-${{ matrix.target }}-cargo-build-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: check build
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests
- name: tests
uses: actions-rs/cargo@v1
timeout-minutes: 40
with:
command: test
args: --package=actix-cors
--package=actix-protobuf
--package=actix-web-httpauth
--all-features --no-fail-fast -- --nocapture
- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache

View File

@ -1,6 +1,6 @@
# actix-extras # actix-extras
[![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![build status](https://github.com/actix/actix-extras/workflows/CI%20%28Linux%29/badge.svg?branch=master&event=push)](https://github.com/actix/actix-extras/actions)
> A collection of additional crates supporting the [actix] and [actix-web] frameworks. > A collection of additional crates supporting the [actix] and [actix-web] frameworks.

View File

@ -6,7 +6,7 @@ description = "Cross-origin resource sharing (CORS) for actix-web applications."
readme = "README.md" readme = "README.md"
keywords = ["cors", "web", "framework"] keywords = ["cors", "web", "framework"]
homepage = "https://actix.rs" homepage = "https://actix.rs"
repository = "https://github.com/actix/actix-web.git" repository = "https://github.com/actix/actix-extras.git"
documentation = "https://docs.rs/actix-cors/" documentation = "https://docs.rs/actix-cors/"
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
edition = "2018" edition = "2018"

View File

@ -3,8 +3,6 @@
[![crates.io](https://img.shields.io/crates/v/actix-cors)](https://crates.io/crates/actix-cors) [![crates.io](https://img.shields.io/crates/v/actix-cors)](https://crates.io/crates/actix-cors)
[![Documentation](https://docs.rs/actix-cors/badge.svg)](https://docs.rs/actix-cors) [![Documentation](https://docs.rs/actix-cors/badge.svg)](https://docs.rs/actix-cors)
[![Dependency Status](https://deps.rs/crate/actix-cors/0.2.0/status.svg)](https://deps.rs/crate/actix-cors/0.2.0) [![Dependency Status](https://deps.rs/crate/actix-cors/0.2.0/status.svg)](https://deps.rs/crate/actix-cors/0.2.0)
[![Build Status](https://travis-ci.org/actix/actix-cors.svg?branch=master)](https://travis-ci.org/actix/actix-cors)
[![codecov](https://codecov.io/gh/actix/actix-cors/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-cors)
![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-cors) ![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-cors)
[![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@ -16,4 +14,4 @@
* [API Documentation](https://docs.rs/actix-cors/) * [API Documentation](https://docs.rs/actix-cors/)
* [Chat on gitter](https://gitter.im/actix/actix) * [Chat on gitter](https://gitter.im/actix/actix)
* Cargo package: [actix-cors](https://crates.io/crates/actix-cors) * Cargo package: [actix-cors](https://crates.io/crates/actix-cors)
* Minimum supported Rust version: 1.34 or later * Minimum supported Rust version: 1.39.0 or later

View File

@ -160,14 +160,12 @@ impl<T> AllOrSome<T> {
/// use actix_cors::Cors; /// use actix_cors::Cors;
/// use actix_web::http::header; /// use actix_web::http::header;
/// ///
/// # fn main() {
/// let cors = Cors::new() /// let cors = Cors::new()
/// .allowed_origin("https://www.rust-lang.org/") /// .allowed_origin("https://www.rust-lang.org/")
/// .allowed_methods(vec!["GET", "POST"]) /// .allowed_methods(vec!["GET", "POST"])
/// .allowed_headers(vec![header::AUTHORIZATION, header::ACCEPT]) /// .allowed_headers(vec![header::AUTHORIZATION, header::ACCEPT])
/// .allowed_header(header::CONTENT_TYPE) /// .allowed_header(header::CONTENT_TYPE)
/// .max_age(3600); /// .max_age(3600);
/// # }
/// ``` /// ```
#[derive(Default)] #[derive(Default)]
pub struct Cors { pub struct Cors {
@ -585,7 +583,7 @@ impl Inner {
AllOrSome::All => Ok(()), AllOrSome::All => Ok(()),
AllOrSome::Some(ref allowed_origins) => allowed_origins AllOrSome::Some(ref allowed_origins) => allowed_origins
.get(origin) .get(origin)
.and_then(|_| Some(())) .map(|_| ())
.ok_or_else(|| CorsError::OriginNotAllowed), .ok_or_else(|| CorsError::OriginNotAllowed),
}; };
} }
@ -633,7 +631,7 @@ impl Inner {
return self return self
.methods .methods
.get(&method) .get(&method)
.and_then(|_| Some(())) .map(|_| ())
.ok_or_else(|| CorsError::MethodNotAllowed); .ok_or_else(|| CorsError::MethodNotAllowed);
} }
} }
@ -651,6 +649,7 @@ impl Inner {
req.headers().get(&header::ACCESS_CONTROL_REQUEST_HEADERS) req.headers().get(&header::ACCESS_CONTROL_REQUEST_HEADERS)
{ {
if let Ok(headers) = hdr.to_str() { if let Ok(headers) = hdr.to_str() {
#[allow(clippy::mutable_key_type)] // FIXME: revisit here
let mut hdrs = HashSet::new(); let mut hdrs = HashSet::new();
for hdr in headers.split(',') { for hdr in headers.split(',') {
match HeaderName::try_from(hdr.trim()) { match HeaderName::try_from(hdr.trim()) {
@ -779,7 +778,7 @@ where
{ {
res.headers_mut().insert( res.headers_mut().insert(
header::ACCESS_CONTROL_ALLOW_ORIGIN, header::ACCESS_CONTROL_ALLOW_ORIGIN,
origin.clone(), origin,
); );
}; };

View File

@ -1,53 +0,0 @@
language: rust
rust:
- stable
- beta
- nightly
os: linux
dist: xenial
env:
global:
- RUSTFLAGS="-C link-dead-code"
addons:
apt:
packages:
- libcurl4-openssl-dev
- libelf-dev
- libdw-dev
- cmake
- gcc
- binutils-dev
- libiberty-dev
# Add clippy
before_script:
- |
if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
( ( rustup component add clippy && export CLIPPY=true ) || export CLIPPY=false );
fi
- export PATH=$PATH:~/.cargo/bin
script:
- |
if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
USE_SKEPTIC=1 cargo test
else
cargo test && cargo check --examples
fi
- |
if [[ "$TRAVIS_RUST_VERSION" == "nightly" && $CLIPPY ]]; then
cargo clippy
fi
# Upload docs
after_success:
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh)
USE_SKEPTIC=1 cargo tarpaulin --out Xml
bash <(curl -s https://codecov.io/bash)
echo "Uploaded code coverage"
fi

View File

@ -6,13 +6,10 @@ authors = ["kingxsp <jin.hb.zh@outlook.com>, Yuki Okushi <huyuumi.dev@gmail.com>
description = "Protobuf support for actix-web framework." description = "Protobuf support for actix-web framework."
readme = "README.md" readme = "README.md"
keywords = ["actix"] keywords = ["actix"]
homepage = "https://github.com/actix/actix-protobuf" homepage = "https://github.com/actix/actix-extras"
repository = "https://github.com/actix/actix-extras.git"
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
exclude = [".travis.yml", ".cargo/config", "/examples/**"] exclude = [".cargo/config", "/examples/**"]
[badges]
travis-ci = { repository = "actix/actix-protobuf", branch = "master" }
codecov = { repository = "actix/actix-protobuf", branch = "master", service = "github" }
[lib] [lib]
name = "actix_protobuf" name = "actix_protobuf"

View File

@ -3,13 +3,13 @@
[![crates.io](https://img.shields.io/crates/v/actix-protobuf)](https://crates.io/crates/actix-protobuf) [![crates.io](https://img.shields.io/crates/v/actix-protobuf)](https://crates.io/crates/actix-protobuf)
[![Documentation](https://docs.rs/actix-protobuf/badge.svg)](https://docs.rs/actix-protobuf) [![Documentation](https://docs.rs/actix-protobuf/badge.svg)](https://docs.rs/actix-protobuf)
[![Dependency Status](https://deps.rs/crate/actix-protobuf/0.5.0/status.svg)](https://deps.rs/crate/actix-protobuf/0.5.0) [![Dependency Status](https://deps.rs/crate/actix-protobuf/0.5.0/status.svg)](https://deps.rs/crate/actix-protobuf/0.5.0)
[![Build Status](https://travis-ci.org/actix/actix-protobuf.svg?branch=master)](https://travis-ci.org/actix/actix-protobuf)
[![codecov](https://codecov.io/gh/actix/actix-protobuf/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-protobuf)
![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-protobuf) ![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-protobuf)
[![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
> Protobuf support for actix-web framework. > Protobuf support for actix-web framework.
* Minimum supported Rust version: 1.39.0 or later
## Example ## Example
```rust,ignore ```rust,ignore

View File

@ -1,65 +0,0 @@
language: rust
rust:
- stable
- beta
- nightly
sudo: required
dist: trusty
services:
- redis-server
env:
global:
- RUSTFLAGS="-C link-dead-code"
addons:
apt:
packages:
- libcurl4-openssl-dev
- libelf-dev
- libdw-dev
- cmake
- gcc
- binutils-dev
- libiberty-dev
# Add clippy
before_script:
- |
if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
( ( cargo install clippy && export CLIPPY=true ) || export CLIPPY=false );
fi
- export PATH=$PATH:~/.cargo/bin
script:
- |
if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
USE_SKEPTIC=1 cargo test
else
cargo test
fi
- |
if [[ "$TRAVIS_RUST_VERSION" == "nightly" && $CLIPPY ]]; then
cargo clippy
fi
# Upload docs
after_success:
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" = "false" && "$TRAVIS_BRANCH" == "master" && "$TRAVIS_RUST_VERSION" == "stable" ]]; then
cargo doc --no-deps &&
echo "<meta http-equiv=refresh content=0;url=os_balloon/index.html>" > target/doc/index.html &&
git clone https://github.com/davisp/ghp-import.git &&
./ghp-import/ghp_import.py -n -p -f -m "Documentation upload" -r https://"$GH_TOKEN"@github.com/"$TRAVIS_REPO_SLUG.git" target/doc &&
echo "Uploaded documentation"
fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh)
USE_SKEPTIC=1 cargo tarpaulin --out Xml
bash <(curl -s https://codecov.io/bash)
echo "Uploaded code coverage"
fi

View File

@ -6,8 +6,8 @@ description = "Redis integration for actix framework"
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
readme = "README.md" readme = "README.md"
keywords = ["web", "redis", "async", "actix", "tokio"] keywords = ["web", "redis", "async", "actix", "tokio"]
homepage = "https://github.com/actix/actix-redis" homepage = "https://github.com/actix/actix-extras"
repository = "https://github.com/actix/actix-redis.git" repository = "https://github.com/actix/actix-extras.git"
documentation = "https://docs.rs/actix-redis/" documentation = "https://docs.rs/actix-redis/"
categories = ["network-programming", "asynchronous"] categories = ["network-programming", "asynchronous"]
exclude = [".travis.yml", ".cargo/config"] exclude = [".travis.yml", ".cargo/config"]
@ -17,10 +17,6 @@ edition = "2018"
name = "actix_redis" name = "actix_redis"
path = "src/lib.rs" path = "src/lib.rs"
[badges]
travis-ci = { repository = "actix/actix-redis", branch = "master" }
codecov = { repository = "actix/actix-redis", branch = "master", service = "github" }
[features] [features]
default = ["web"] default = ["web"]

View File

@ -3,8 +3,6 @@
[![crates.io](https://img.shields.io/crates/v/actix-redis)](https://crates.io/crates/actix-redis) [![crates.io](https://img.shields.io/crates/v/actix-redis)](https://crates.io/crates/actix-redis)
[![Documentation](https://docs.rs/actix-redis/badge.svg)](https://docs.rs/actix-redis) [![Documentation](https://docs.rs/actix-redis/badge.svg)](https://docs.rs/actix-redis)
[![Dependency Status](https://deps.rs/crate/actix-redis/0.8.0/status.svg)](https://deps.rs/crate/actix-redis/0.8.0) [![Dependency Status](https://deps.rs/crate/actix-redis/0.8.0/status.svg)](https://deps.rs/crate/actix-redis/0.8.0)
[![Build Status](https://travis-ci.org/actix/actix-redis.svg?branch=master)](https://travis-ci.org/actix/actix-redis)
[![codecov](https://codecov.io/gh/actix/actix-redis/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-redis)
![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-redis) ![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-redis)
[![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@ -12,7 +10,7 @@
## Documentation ## Documentation
* [API Documentation](http://actix.github.io/actix-redis/actix_redis/) * [API Documentation](http://actix.rs/actix-extras/actix_redis/)
* [Chat on gitter](https://gitter.im/actix/actix) * [Chat on gitter](https://gitter.im/actix/actix)
* Cargo package: [actix-redis](https://crates.io/crates/actix-redis) * Cargo package: [actix-redis](https://crates.io/crates/actix-redis)
* Minimum supported Rust version: 1.39 or later * Minimum supported Rust version: 1.39 or later

View File

@ -134,6 +134,7 @@ where
type Request = ServiceRequest; type Request = ServiceRequest;
type Response = ServiceResponse<B>; type Response = ServiceResponse<B>;
type Error = Error; type Error = Error;
#[allow(clippy::type_complexity)]
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>>>>; type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>>>>;
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
@ -266,7 +267,7 @@ impl Inner {
value: Option<String>, value: Option<String>,
) -> Result<ServiceResponse<B>, Error> { ) -> Result<ServiceResponse<B>, Error> {
let (value, jar) = if let Some(value) = value { let (value, jar) = if let Some(value) = value {
(value.clone(), None) (value, None)
} else { } else {
let value: String = iter::repeat(()) let value: String = iter::repeat(())
.map(|()| OsRng.sample(Alphanumeric)) .map(|()| OsRng.sample(Alphanumeric))
@ -559,7 +560,7 @@ mod test {
.unwrap(); .unwrap();
assert_eq!( assert_eq!(
true, true,
cookie_1.value().to_string() != cookie_2.value().to_string() cookie_1.value() != cookie_2.value()
); );
let result_5 = resp_5.json::<IndexResponse>().await.unwrap(); let result_5 = resp_5.json::<IndexResponse>().await.unwrap();
@ -618,7 +619,7 @@ mod test {
counter: 0 counter: 0
} }
); );
assert!(cookie_3.value().to_string() != cookie_2.value().to_string()); assert!(cookie_3.value() != cookie_2.value());
// Step 9: POST to logout, including session cookie #2 // Step 9: POST to logout, including session cookie #2
// - set-cookie actix-session will be in response with session cookie #2 // - set-cookie actix-session will be in response with session cookie #2
@ -632,7 +633,7 @@ mod test {
.into_iter() .into_iter()
.find(|c| c.name() == "test-session") .find(|c| c.name() == "test-session")
.unwrap(); .unwrap();
assert!(&time::now().tm_year != &cookie_4.expires().map(|t| t.tm_year).unwrap()); assert_ne!(time::now().tm_year, cookie_4.expires().map(|t| t.tm_year).unwrap());
// Step 10: GET index, including session cookie #2 in request // Step 10: GET index, including session cookie #2 in request
// - set-cookie actix-session will be in response (session cookie #3) // - set-cookie actix-session will be in response (session cookie #3)
@ -655,6 +656,6 @@ mod test {
.into_iter() .into_iter()
.find(|c| c.name() == "test-session") .find(|c| c.name() == "test-session")
.unwrap(); .unwrap();
assert!(cookie_5.value().to_string() != cookie_2.value().to_string()); assert!(cookie_5.value() != cookie_2.value());
} }
} }

View File

@ -1,28 +0,0 @@
name: Clippy and rustfmt check
on:
push:
branches:
- master
pull_request:
jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: clippy, rustfmt
override: true
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features
- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

View File

@ -1,83 +0,0 @@
name: CI
on:
push:
branches:
- master
pull_request:
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
toolchain:
- x86_64-pc-windows-msvc
- x86_64-pc-windows-gnu
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
version:
- stable
- nightly
include:
- toolchain: x86_64-pc-windows-msvc
os: windows-latest
- toolchain: x86_64-pc-windows-gnu
os: windows-latest
- toolchain: x86_64-unknown-linux-gnu
os: ubuntu-latest
- toolchain: x86_64-apple-darwin
os: macOS-latest
name: ${{ matrix.version }} - ${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-${{ matrix.toolchain }}
profile: minimal
override: true
- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: update
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ matrix.version }}-${{ matrix.toolchain }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ matrix.version }}-${{ matrix.toolchain }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ matrix.version }}-${{ matrix.toolchain }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
- name: checks
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests
- name: tests (stable)
if: matrix.version == 'stable'
uses: actions-rs/cargo@v1
with:
command: test
args: --all --no-fail-fast -- --nocapture
- name: tests (nightly)
if: matrix.version == 'nightly'
uses: actions-rs/cargo@v1
with:
command: test
args: --all --all-features --no-fail-fast -- --nocapture

View File

@ -1,55 +0,0 @@
name: Check MSRV
on:
push:
branches:
- master
pull_request:
jobs:
build_and_test:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.39.0-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: update
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: msrv-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: msrv-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: msrv-cargo-build-${{ hashFiles('**/Cargo.lock') }}
- name: checks
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests
- name: tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all --no-fail-fast -- --nocapture

View File

@ -5,12 +5,11 @@ authors = ["svartalf <self@svartalf.info>", "Yuki Okushi <huyuumi.dev@gmail.com>
description = "HTTP authentication schemes for actix-web" description = "HTTP authentication schemes for actix-web"
readme = "README.md" readme = "README.md"
keywords = ["http", "web", "framework"] keywords = ["http", "web", "framework"]
homepage = "https://github.com/actix/actix-web-httpauth" homepage = "https://github.com/actix/actix-extras"
repository = "https://github.com/actix/actix-web-httpauth.git" repository = "https://github.com/actix/actix-extras.git"
documentation = "https://docs.rs/actix-web-httpauth/" documentation = "https://docs.rs/actix-web-httpauth/"
categories = ["web-programming::http-server"] categories = ["web-programming::http-server"]
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
exclude = [".github/*"]
edition = "2018" edition = "2018"
[lib] [lib]
@ -29,7 +28,7 @@ actix-rt = "1.0"
[features] [features]
default = [] default = []
nightly = [] nightly = [] # leave it for compatibility
[badges] [badges]
maintenance = { status = "passively-maintained" } maintenance = { status = "passively-maintained" }

View File

@ -3,8 +3,6 @@
[![crates.io](https://img.shields.io/crates/v/actix-web-httpauth)](https://crates.io/crates/actix-web-httpauth) [![crates.io](https://img.shields.io/crates/v/actix-web-httpauth)](https://crates.io/crates/actix-web-httpauth)
[![Documentation](https://docs.rs/actix-web-httpauth/badge.svg)](https://docs.rs/actix-web-httpauth) [![Documentation](https://docs.rs/actix-web-httpauth/badge.svg)](https://docs.rs/actix-web-httpauth)
[![Dependency Status](https://deps.rs/crate/actix-web-httpauth/0.4.0/status.svg)](https://deps.rs/crate/actix-web-httpauth/0.4.0) [![Dependency Status](https://deps.rs/crate/actix-web-httpauth/0.4.0/status.svg)](https://deps.rs/crate/actix-web-httpauth/0.4.0)
![Build Status](https://github.com/actix/actix-web-httpauth/workflows/CI/badge.svg?branch=master&event=push)
[![codecov](https://codecov.io/gh/actix/actix-web-httpauth/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-web-httpauth)
![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-web-httpauth) ![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-web-httpauth)
[![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@ -15,7 +13,7 @@ Provides:
* [extractors] for an [Authorization] header * [extractors] for an [Authorization] header
* [middleware] for easier authorization checking * [middleware] for easier authorization checking
All supported schemas are actix [Extractors](https://docs.rs/actix-web/1.0.0/actix_web/trait.FromRequest.html), All supported schemas are actix [Extractors](https://docs.rs/actix-web/2.0.0/actix_web/trait.FromRequest.html),
and can be used both in the middlewares and request handlers. and can be used both in the middlewares and request handlers.
## Supported schemes ## Supported schemes

View File

@ -21,7 +21,6 @@
#![deny(rust_2018_idioms)] #![deny(rust_2018_idioms)]
#![deny(unused)] #![deny(unused)]
#![deny(clippy::all)] #![deny(clippy::all)]
#![cfg_attr(feature = "nightly", feature(test))]
pub mod extractors; pub mod extractors;
pub mod headers; pub mod headers;