Skip to content

Commit

Permalink
chore(CI): enable GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Dec 5, 2019
1 parent edbd10a commit b0060f2
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 40 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ url = "1.0"

[features]
default = [
"__internal_flaky_tests",
"runtime",
"stream",
]
Expand All @@ -75,7 +74,6 @@ stream = []

# internal features used in CI
nightly = []
__internal_flaky_tests = []
__internal_happy_eyeballs_tests = []

[package.metadata.docs.rs]
Expand Down
11 changes: 9 additions & 2 deletions src/client/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ use std::collections::{HashMap, HashSet, VecDeque};
use std::fmt;
use std::ops::{Deref, DerefMut};
use std::sync::{Arc, Mutex, Weak};

#[cfg(not(feature = "runtime"))]
use std::time::{Duration, Instant};

use futures_channel::oneshot;
#[cfg(feature = "runtime")]
use tokio::time::Interval;
use tokio::time::{Duration, Instant, Interval};

use crate::common::{Exec, Future, Pin, Poll, Unpin, task};
use super::Ver;
Expand Down Expand Up @@ -899,6 +901,9 @@ mod tests {
#[cfg(feature = "runtime")]
#[tokio::test]
async fn test_pool_timer_removes_expired() {
let _ = pretty_env_logger::try_init();
tokio::time::pause();

let pool = Pool::new(super::Config {
enabled: true,
keep_alive_timeout: Some(Duration::from_millis(10)),
Expand All @@ -916,7 +921,9 @@ mod tests {
assert_eq!(pool.locked().idle.get(&key).map(|entries| entries.len()), Some(3));

// 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());
}
Expand Down
3 changes: 0 additions & 3 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
http2_parallel_10,
parallel: 0..10
Expand Down

0 comments on commit b0060f2

Please sign in to comment.