diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..6e506bc --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,56 @@ +on: [push, pull_request] + +name: Tests and linting + +jobs: + test: + name: Test Suite + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features + - uses: actions-rs/cargo@v1 # we also test without the default `read-url` feature + with: + command: test + args: --no-default-features + + lints: + name: Lints + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + components: rustfmt, clippy + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings diff --git a/src/lib.rs b/src/lib.rs index 2fbbf4f..708f51c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,14 @@ extern crate flatbuffers; +#[allow(unused_imports)] +#[allow(clippy::all)] mod lrs_generated; -use flatbuffers::WIPOffset; pub use lrs_generated::*; #[test] fn read_and_write_lrs() { + use flatbuffers::WIPOffset; let mut fbb = flatbuffers::FlatBufferBuilder::with_capacity(1024); let property = PropertyArgs { key: Some(fbb.create_string("some key")),