Merge pull request #347 from snapview/github-actions

Exchange Travis CI for GitHub Actions
pull/348/head
Daniel Abramov 2 years ago committed by GitHub
commit 79fa37888f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 70
      .github/workflows/ci.yml
  2. 14
      .travis.yml
  3. 24
      Cargo.toml
  4. 3
      benches/buffer.rs
  5. 4
      src/handshake/client.rs
  6. 4
      src/lib.rs
  7. 3
      tests/connection_reset.rs
  8. 3
      tests/no_send_after_close.rs
  9. 3
      tests/receive_after_init_close.rs

@ -0,0 +1,70 @@
name: CI
on: [push, pull_request]
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all --check
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Install dependencies
run: sudo apt-get install libssl-dev
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Check
run: cargo hack check --feature-powerset --all-targets
- name: Test
run: cargo test --release
autobahn:
name: Autobahn tests
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Running Autobahn TestSuite for client
run: ./scripts/autobahn-client.sh
- name: Running Autobahn TestSuite for server
run: ./scripts/autobahn-server.sh

@ -1,14 +0,0 @@
language: rust
rust:
- stable
services:
- docker
before_script:
- export PATH="$PATH:$HOME/.cargo/bin"
script:
- cargo test --release
- echo "Running Autobahn TestSuite for client" && ./scripts/autobahn-client.sh
- echo "Running Autobahn TestSuite for server" && ./scripts/autobahn-server.sh

@ -71,3 +71,27 @@ rand = "0.8.4"
[[bench]]
name = "buffer"
harness = false
[[example]]
name = "client"
required-features = ["handshake"]
[[example]]
name = "server"
required-features = ["handshake"]
[[example]]
name = "autobahn-client"
required-features = ["handshake"]
[[example]]
name = "autobahn-server"
required-features = ["handshake"]
[[example]]
name = "callback-error"
required-features = ["handshake"]
[[example]]
name = "srv_accept_unmasked_frames"
required-features = ["handshake"]

@ -1,5 +1,4 @@
use std::io::Result as IoResult;
use std::io::{Cursor, Read};
use std::io::{Cursor, Read, Result as IoResult};
use bytes::Buf;
use criterion::*;

@ -87,8 +87,8 @@ impl<S: Read + Write> HandshakeRole for ClientHandshake<S> {
Ok(r) => r,
Err(Error::Http(mut e)) => {
*e.body_mut() = Some(tail);
return Err(Error::Http(e))
},
return Err(Error::Http(e));
}
Err(e) => return Err(e),
};

@ -25,7 +25,7 @@ pub mod protocol;
#[cfg(feature = "handshake")]
mod server;
pub mod stream;
#[cfg(any(feature = "native-tls", feature = "__rustls-tls"))]
#[cfg(all(any(feature = "native-tls", feature = "__rustls-tls"), feature = "handshake"))]
mod tls;
pub mod util;
@ -44,5 +44,5 @@ pub use crate::{
server::{accept, accept_hdr, accept_hdr_with_config, accept_with_config},
};
#[cfg(any(feature = "native-tls", feature = "__rustls-tls"))]
#[cfg(all(any(feature = "native-tls", feature = "__rustls-tls"), feature = "handshake"))]
pub use tls::{client_tls, client_tls_with_config, Connector};

@ -1,6 +1,7 @@
//! Verifies that the server returns a `ConnectionClosed` error when the connection
//! is closed from the server's point of view and drop the underlying tcp socket.
#![cfg(any(feature = "native-tls", feature = "__rustls-tls"))]
#![cfg(all(any(feature = "native-tls", feature = "__rustls-tls"), feature = "handshake"))]
use std::{
net::{TcpListener, TcpStream},

@ -1,6 +1,8 @@
//! Verifies that we can read data messages even if we have initiated a close handshake,
//! but before we got confirmation.
#![cfg(feature = "handshake")]
use std::{
net::TcpListener,
process::exit,
@ -8,7 +10,6 @@ use std::{
time::Duration,
};
#[cfg(feature = "handshake")]
use tungstenite::{accept, connect, error::ProtocolError, Error, Message};
use url::Url;

@ -1,6 +1,8 @@
//! Verifies that we can read data messages even if we have initiated a close handshake,
//! but before we got confirmation.
#![cfg(feature = "handshake")]
use std::{
net::TcpListener,
process::exit,
@ -8,7 +10,6 @@ use std::{
time::Duration,
};
#[cfg(feature = "handshake")]
use tungstenite::{accept, connect, Error, Message};
use url::Url;

Loading…
Cancel
Save