Merge pull request #1 from axodotdev/see-aye-yi-yi

feat(infra): add rust clippy, fmt, tests github action
This commit is contained in:
ashley williams 2022-12-16 08:13:54 -06:00 committed by GitHub
commit 0dca44a39e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 31 deletions

View File

@ -1,33 +1,47 @@
name: Continuous Integration
name: Rust
on:
push:
pull_request:
push:
branches:
- main
schedule:
- cron: "0 0 1,15 * *"
- cron: '11 7 * * 1,4'
env:
RUSTFLAGS: -Dwarnings
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:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [stable, beta, nightly]
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
- uses: actions/checkout@v1
- 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
- uses: actions/checkout@v2
- name: Run cargo test
run: |
cargo test --workspace

View File

@ -172,9 +172,11 @@ mod tests {
#[test]
fn test_events_iter() {
let mut events: Events<&str> = Events::default();
events.abort = Some("abort");
events.waiting = Some("waiting");
let events = Events::<&str> {
abort: Some("abort"),
waiting: Some("waiting"),
..Default::default()
};
let mut iter = events.iter();
assert_eq!(iter.next(), Some(("abort", &"abort")));
@ -184,9 +186,11 @@ mod tests {
#[test]
fn test_events_iter_mut() {
let mut events: Events<&str> = Events::default();
events.abort = Some("abort");
events.waiting = Some("waiting");
let mut events = Events::<&str> {
abort: Some("abort"),
waiting: Some("waiting"),
..Default::default()
};
let mut iter = events.iter_mut();
assert_eq!(iter.next(), Some(("abort", &mut "abort")));
@ -196,9 +200,11 @@ mod tests {
#[test]
fn test_events_into_iter() {
let mut events: Events<&str> = Events::default();
events.abort = Some("abort");
events.waiting = Some("waiting");
let events = Events::<&str> {
abort: Some("abort"),
waiting: Some("waiting"),
..Default::default()
};
let mut iter = events.into_iter();
assert_eq!(iter.next(), Some(("abort", "abort")));