Skip to content

Commit

Permalink
Merge pull request #1 from mxinden/add-github
Browse files Browse the repository at this point in the history
.github: Add Dependabot and CI automation
  • Loading branch information
mxinden authored Jan 14, 2021
2 parents 13a1c9c + d05295a commit f270fb7
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"
107 changes: 107 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
on: [push, pull_request]

name: Continuous integration

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

# Caching
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: cargo-registry-${{ hashFiles('Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: cargo-index-${{ hashFiles('Cargo.toml') }}

- uses: actions-rs/cargo@v1
with:
command: check
args: --all --all-features

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

# Caching
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: cargo-registry-${{ hashFiles('Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: cargo-index-${{ hashFiles('Cargo.toml') }}

- uses: actions-rs/cargo@v1
with:
command: test
args: --all --all-features

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy

# Caching
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: cargo-registry-${{ hashFiles('Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: cargo-index-${{ hashFiles('Cargo.toml') }}

- uses: actions-rs/cargo@v1
continue-on-error: true
with:
command: clippy
args: -- -D warnings
2 changes: 1 addition & 1 deletion benches/lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

extern crate test;

use futures::{executor, io::Cursor, TryStreamExt};
use asynchronous_codec::{FramedRead, LinesCodec};
use futures::{executor, io::Cursor, TryStreamExt};

#[bench]
fn short(b: &mut test::Bencher) {
Expand Down
2 changes: 0 additions & 2 deletions src/codec/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ where
}
}


impl<Enc, Dec> Default for JsonCodec<Enc, Dec>
where
for<'de> Dec: Deserialize<'de> + 'static,
Expand All @@ -164,7 +163,6 @@ where
}
}


#[cfg(test)]
mod test {
use bytes::BytesMut;
Expand Down
2 changes: 1 addition & 1 deletion tests/bytes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use asynchronous_codec::{BytesCodec, Framed};
use futures::io::Cursor;
use futures::{executor, TryStreamExt};
use asynchronous_codec::{BytesCodec, Framed};

#[test]
fn decodes() {
Expand Down
2 changes: 1 addition & 1 deletion tests/framed_read.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use asynchronous_codec::{BytesMut, Decoder, FramedRead, LinesCodec};
use futures::executor;
use futures::stream::StreamExt;
use futures::AsyncRead;
use asynchronous_codec::{BytesMut, Decoder, FramedRead, LinesCodec};
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
Expand Down
2 changes: 1 addition & 1 deletion tests/framed_write.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use asynchronous_codec::{Bytes, BytesCodec, FramedWrite, LinesCodec};
use core::iter::Iterator;
use futures::io::{AsyncWrite, Cursor};
use futures::sink::SinkExt;
use futures::{executor, stream, stream::StreamExt};
use asynchronous_codec::{Bytes, BytesCodec, FramedWrite, LinesCodec};
use std::pin::Pin;
use std::task::{Context, Poll};

Expand Down
2 changes: 1 addition & 1 deletion tests/length_delimited.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use asynchronous_codec::{Bytes, Framed, LengthCodec};
use futures::io::Cursor;
use futures::{executor, SinkExt, StreamExt};
use asynchronous_codec::{Bytes, Framed, LengthCodec};

#[test]
fn same_msgs_are_received_as_were_sent() {
Expand Down
2 changes: 1 addition & 1 deletion tests/lines.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use asynchronous_codec::{FramedRead, LinesCodec};
use futures::io::Cursor;
use futures::{executor, TryStreamExt};
use asynchronous_codec::{FramedRead, LinesCodec};

#[test]
fn it_works() {
Expand Down

0 comments on commit f270fb7

Please sign in to comment.