Merge pull request #1 from axodotdev/see-aye-yi-yi
feat(infra): add rust clippy, fmt, tests github action
This commit is contained in:
commit
0dca44a39e
|
@ -1,33 +1,47 @@
|
||||||
name: Continuous Integration
|
name: Rust
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 1,15 * *"
|
- cron: '11 7 * * 1,4'
|
||||||
|
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: -Dwarnings
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
fmt:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Run cargo fmt
|
||||||
|
run: |
|
||||||
|
cargo fmt --all -- --check
|
||||||
|
clippy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Run cargo clippy
|
||||||
|
run: |
|
||||||
|
cargo clippy --workspace --tests --examples
|
||||||
|
docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
RUSTDOCFLAGS: -Dwarnings
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Run cargo clippy
|
||||||
|
run: |
|
||||||
|
cargo doc --workspace --no-deps
|
||||||
test:
|
test:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
rust: [stable, beta, nightly]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: hecrj/setup-rust-action@v1
|
- uses: actions/checkout@v2
|
||||||
with:
|
- name: Run cargo test
|
||||||
rust-version: ${{ matrix.rust }}
|
run: |
|
||||||
- uses: actions/checkout@v1
|
cargo test --workspace
|
||||||
- name: Run tests
|
|
||||||
run: cargo test --all-features
|
|
||||||
|
|
||||||
clippy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: hecrj/setup-rust-action@v1
|
|
||||||
with:
|
|
||||||
rust-version: stable
|
|
||||||
components: clippy
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: Clippy
|
|
||||||
run: cargo clippy -- -D warnings
|
|
||||||
|
|
|
@ -172,9 +172,11 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_events_iter() {
|
fn test_events_iter() {
|
||||||
let mut events: Events<&str> = Events::default();
|
let events = Events::<&str> {
|
||||||
events.abort = Some("abort");
|
abort: Some("abort"),
|
||||||
events.waiting = Some("waiting");
|
waiting: Some("waiting"),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
let mut iter = events.iter();
|
let mut iter = events.iter();
|
||||||
assert_eq!(iter.next(), Some(("abort", &"abort")));
|
assert_eq!(iter.next(), Some(("abort", &"abort")));
|
||||||
|
@ -184,9 +186,11 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_events_iter_mut() {
|
fn test_events_iter_mut() {
|
||||||
let mut events: Events<&str> = Events::default();
|
let mut events = Events::<&str> {
|
||||||
events.abort = Some("abort");
|
abort: Some("abort"),
|
||||||
events.waiting = Some("waiting");
|
waiting: Some("waiting"),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
let mut iter = events.iter_mut();
|
let mut iter = events.iter_mut();
|
||||||
assert_eq!(iter.next(), Some(("abort", &mut "abort")));
|
assert_eq!(iter.next(), Some(("abort", &mut "abort")));
|
||||||
|
@ -196,9 +200,11 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_events_into_iter() {
|
fn test_events_into_iter() {
|
||||||
let mut events: Events<&str> = Events::default();
|
let events = Events::<&str> {
|
||||||
events.abort = Some("abort");
|
abort: Some("abort"),
|
||||||
events.waiting = Some("waiting");
|
waiting: Some("waiting"),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
let mut iter = events.into_iter();
|
let mut iter = events.into_iter();
|
||||||
assert_eq!(iter.next(), Some(("abort", "abort")));
|
assert_eq!(iter.next(), Some(("abort", "abort")));
|
||||||
|
|
Loading…
Reference in New Issue