mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-30 10:32:55 +01:00
Run CI with GitHub Actions (#16)
* Run CI with GitHub Actions * Remove benchmarks for now * Check MSRV
This commit is contained in:
parent
deb1508d2f
commit
b4508baf7e
28
.github/workflows/clippy-and-fmt.yml
vendored
Normal file
28
.github/workflows/clippy-and-fmt.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
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
|
62
.github/workflows/main.yml
vendored
Normal file
62
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
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 }}
|
||||
default: true
|
||||
|
||||
- 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
|
35
.github/workflows/msrv.yml
vendored
Normal file
35
.github/workflows/msrv.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
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
|
||||
default: true
|
||||
|
||||
- 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
|
@ -202,31 +202,3 @@ mod tests {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, feature = "nightly"))]
|
||||
mod benches {
|
||||
use test::Bencher;
|
||||
|
||||
use actix_web::http::header::{HeaderValue, IntoHeaderValue};
|
||||
|
||||
use super::{Basic, Scheme};
|
||||
|
||||
#[bench]
|
||||
fn bench_parsing(b: &mut Bencher) {
|
||||
let value =
|
||||
HeaderValue::from_static("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
|
||||
b.iter(|| Basic::parse(&value));
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_serializing(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let basic = Basic {
|
||||
user_id: "Aladdin".into(),
|
||||
password: Some("open sesame".into()),
|
||||
};
|
||||
|
||||
basic.try_into()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user