chore(CI): enable GitHub Actions
This commit is contained in:
76
.github/workflows/CI.yml
vendored
Normal file
76
.github/workflows/CI.yml
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
env:
|
||||||
|
RUST_BACKTRACE: 1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Test ${{ matrix.rust }} on ${{ matrix.os }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
rust:
|
||||||
|
- stable
|
||||||
|
- beta
|
||||||
|
- nightly
|
||||||
|
# - 1.39.0
|
||||||
|
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- windows-latest
|
||||||
|
- macOS-latest
|
||||||
|
|
||||||
|
include:
|
||||||
|
- rust: stable
|
||||||
|
features: ""
|
||||||
|
- rust: beta
|
||||||
|
features: ""
|
||||||
|
- rust: nightly
|
||||||
|
features: "--features nightly"
|
||||||
|
benches: true
|
||||||
|
# Limit the Happy Eyeballs tests to Linux
|
||||||
|
- rust: stable
|
||||||
|
os: ubuntu-latest
|
||||||
|
features: "--features __internal_happy_eyeballs_tests"
|
||||||
|
# - rust: 1.39.0
|
||||||
|
# features: "--no-default-features --features runtime"
|
||||||
|
# build-only: true
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Install Rust (${{ matrix.rust }})
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: ${{ matrix.rust }}
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Build only
|
||||||
|
if: matrix.build-only
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
args: ${{ matrix.features }}
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
if: matrix.build-only != true
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: ${{ matrix.features }}
|
||||||
|
|
||||||
|
- name: Test all benches
|
||||||
|
if: matrix.benches && matrix.build-only != true
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --benches ${{ matrix.features }}
|
||||||
33
.travis.yml
33
.travis.yml
@@ -1,33 +0,0 @@
|
|||||||
language: rust
|
|
||||||
sudo: true # Required for functional IPv6 (forces VM instead of Docker).
|
|
||||||
dist: trusty
|
|
||||||
matrix:
|
|
||||||
fast_finish: true
|
|
||||||
include:
|
|
||||||
- rust: nightly
|
|
||||||
env: FEATURES="--no-default-features --features runtime,stream,nightly"
|
|
||||||
- rust: beta
|
|
||||||
env: FEATURES="--no-default-features --features runtime,stream,__internal_happy_eyeballs_tests"
|
|
||||||
#- rust: stable
|
|
||||||
# env: FEATURES="--no-default-features --features runtime,stream,__internal_happy_eyeballs_tests"
|
|
||||||
- rust: beta #stable
|
|
||||||
env: FEATURES="--no-default-features"
|
|
||||||
# Minimum Supported Rust Version
|
|
||||||
#- rust: 1.39.0
|
|
||||||
# env: FEATURES="--no-default-features --features runtime" BUILD_ONLY="1"
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
# Add an IPv6 config - see the corresponding Travis issue
|
|
||||||
# https://github.com/travis-ci/travis-ci/issues/83
|
|
||||||
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
|
|
||||||
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6';
|
|
||||||
fi
|
|
||||||
|
|
||||||
script:
|
|
||||||
- 'if [ "$BUILD_ONLY" != "1" ]; then cargo test $FEATURES -- --test-threads=1; fi'
|
|
||||||
- 'if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo test --benches $FEATURES; fi'
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- RUST_BACKTRACE=1
|
|
||||||
- secure: KipdEhZsGIrb2W0HsDbC95x8FJ1RKEWPq8uSK8wSZwGw6MtvoZDX0edfrtf4o3/skA0h84yn35ZWF/rpo1ZEesgFY1g+l+me+jtyGvMwEsXTGjNP4oNR2MrDizjO8eYDm4hRUCLEmJVvsq4j7oNVdLGHfdrcnwqk8/NxJsRzqXM=
|
|
||||||
@@ -55,7 +55,6 @@ url = "1.0"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [
|
default = [
|
||||||
"__internal_flaky_tests",
|
|
||||||
"runtime",
|
"runtime",
|
||||||
"stream",
|
"stream",
|
||||||
]
|
]
|
||||||
@@ -75,7 +74,6 @@ stream = []
|
|||||||
|
|
||||||
# internal features used in CI
|
# internal features used in CI
|
||||||
nightly = []
|
nightly = []
|
||||||
__internal_flaky_tests = []
|
|
||||||
__internal_happy_eyeballs_tests = []
|
__internal_happy_eyeballs_tests = []
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ use std::collections::{HashMap, HashSet, VecDeque};
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::sync::{Arc, Mutex, Weak};
|
use std::sync::{Arc, Mutex, Weak};
|
||||||
|
|
||||||
|
#[cfg(not(feature = "runtime"))]
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use futures_channel::oneshot;
|
use futures_channel::oneshot;
|
||||||
#[cfg(feature = "runtime")]
|
#[cfg(feature = "runtime")]
|
||||||
use tokio::time::Interval;
|
use tokio::time::{Duration, Instant, Interval};
|
||||||
|
|
||||||
use crate::common::{Exec, Future, Pin, Poll, Unpin, task};
|
use crate::common::{Exec, Future, Pin, Poll, Unpin, task};
|
||||||
use super::Ver;
|
use super::Ver;
|
||||||
@@ -899,6 +901,9 @@ mod tests {
|
|||||||
#[cfg(feature = "runtime")]
|
#[cfg(feature = "runtime")]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_pool_timer_removes_expired() {
|
async fn test_pool_timer_removes_expired() {
|
||||||
|
let _ = pretty_env_logger::try_init();
|
||||||
|
tokio::time::pause();
|
||||||
|
|
||||||
let pool = Pool::new(super::Config {
|
let pool = Pool::new(super::Config {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
keep_alive_timeout: Some(Duration::from_millis(10)),
|
keep_alive_timeout: Some(Duration::from_millis(10)),
|
||||||
@@ -916,7 +921,9 @@ mod tests {
|
|||||||
assert_eq!(pool.locked().idle.get(&key).map(|entries| entries.len()), Some(3));
|
assert_eq!(pool.locked().idle.get(&key).map(|entries| entries.len()), Some(3));
|
||||||
|
|
||||||
// Let the timer tick passed the expiration...
|
// Let the timer tick passed the expiration...
|
||||||
tokio::time::delay_for(Duration::from_millis(50)).await;
|
tokio::time::advance(Duration::from_millis(30)).await;
|
||||||
|
// Yield so the Interval can reap...
|
||||||
|
tokio::task::yield_now().await;
|
||||||
|
|
||||||
assert!(pool.locked().idle.get(&key).is_none());
|
assert!(pool.locked().idle.get(&key).is_none());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -333,9 +333,6 @@ t! {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In rare cases, the h2 client connection does not shutdown, resulting
|
|
||||||
// in this test simply hanging... :(
|
|
||||||
#[cfg(feature = "__internal_flaky_tests")]
|
|
||||||
t! {
|
t! {
|
||||||
http2_parallel_10,
|
http2_parallel_10,
|
||||||
parallel: 0..10
|
parallel: 0..10
|
||||||
|
|||||||
Reference in New Issue
Block a user