diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml new file mode 100644 index 0000000..4568595 --- /dev/null +++ b/.github/workflows/rust.yaml @@ -0,0 +1,74 @@ +name: Rust + +on: [push, pull_request] + +jobs: + formatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + components: rustfmt + - name: Format + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + components: clippy + - name: Clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --all --all-targets -- -Dwarnings + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + - name: Test all-targets + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace --all-targets + - name: Test docs + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace --doc + + docs: + runs-on: ubuntu-latest + name: Build-test docs + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + - name: Document all crates + uses: actions-rs/cargo@v1 + env: + RUSTDOCFLAGS: -Dwarnings + with: + command: doc + args: --all --all-features --no-deps --document-private-items diff --git a/src/subcommand.rs b/src/subcommand.rs index 3eb5e0a..84a29c6 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -195,14 +195,29 @@ mod tests { #[test] fn test_separator_space() { - let args = ["cargo", "subcommand", "build", "--target", "x86_64-unknown-linux-gnu"].iter().map(|s| s.to_string()); + let args = [ + "cargo", + "subcommand", + "build", + "--target", + "x86_64-unknown-linux-gnu", + ] + .iter() + .map(|s| s.to_string()); let cmd = Subcommand::new(args, "subcommand", |_, _| Ok(false)).unwrap(); assert_eq!(cmd.target(), Some("x86_64-unknown-linux-gnu")); } #[test] fn test_separator_equals() { - let args = ["cargo", "subcommand", "build", "--target=x86_64-unknown-linux-gnu"].iter().map(|s| s.to_string()); + let args = [ + "cargo", + "subcommand", + "build", + "--target=x86_64-unknown-linux-gnu", + ] + .iter() + .map(|s| s.to_string()); let cmd = Subcommand::new(args, "subcommand", |_, _| Ok(false)).unwrap(); assert_eq!(cmd.target(), Some("x86_64-unknown-linux-gnu")); }