Skip to content

Commit

Permalink
add github actions to test linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristramg committed Feb 21, 2024
1 parent 364bd18 commit b74ca8c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
56 changes: 56 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -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")),
Expand Down

0 comments on commit b74ca8c

Please sign in to comment.