Skip to content

Commit b74ca8c

Browse files
committed
add github actions to test linting
1 parent 364bd18 commit b74ca8c

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

.github/workflows/tests.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
on: [push, pull_request]
2+
3+
name: Tests and linting
4+
5+
jobs:
6+
test:
7+
name: Test Suite
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/cache@v2
12+
with:
13+
path: |
14+
~/.cargo/bin/
15+
~/.cargo/registry/index/
16+
~/.cargo/registry/cache/
17+
~/.cargo/git/db/
18+
target/
19+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
20+
- uses: actions-rs/toolchain@v1
21+
with:
22+
toolchain: stable
23+
- uses: actions-rs/cargo@v1
24+
with:
25+
command: test
26+
args: --all-features
27+
- uses: actions-rs/cargo@v1 # we also test without the default `read-url` feature
28+
with:
29+
command: test
30+
args: --no-default-features
31+
32+
lints:
33+
name: Lints
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout sources
37+
uses: actions/checkout@v2
38+
39+
- name: Install stable toolchain
40+
uses: actions-rs/toolchain@v1
41+
with:
42+
profile: minimal
43+
toolchain: stable
44+
components: rustfmt, clippy
45+
46+
- name: Run cargo fmt
47+
uses: actions-rs/cargo@v1
48+
with:
49+
command: fmt
50+
args: --all -- --check
51+
52+
- name: Run cargo clippy
53+
uses: actions-rs/cargo@v1
54+
with:
55+
command: clippy
56+
args: -- -D warnings

src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
extern crate flatbuffers;
22

3+
#[allow(unused_imports)]
4+
#[allow(clippy::all)]
35
mod lrs_generated;
46

5-
use flatbuffers::WIPOffset;
67
pub use lrs_generated::*;
78

89
#[test]
910
fn read_and_write_lrs() {
11+
use flatbuffers::WIPOffset;
1012
let mut fbb = flatbuffers::FlatBufferBuilder::with_capacity(1024);
1113
let property = PropertyArgs {
1214
key: Some(fbb.create_string("some key")),

0 commit comments

Comments
 (0)