Skip to content

Commit

Permalink
ci: Inherit simplified GitHub Actions CI script from android-ndk (#13)
Browse files Browse the repository at this point in the history
* ci: Inherit simplified GitHub Actions CI script from android-ndk

Let GH CI help us check formatting, clippy, the few tests that we have
and build-test the documentation.

* cargo fmt
MarijnS95 authored Mar 3, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 7166d6f commit 0a53c89
Showing 2 changed files with 91 additions and 2 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 17 additions & 2 deletions src/subcommand.rs
Original file line number Diff line number Diff line change
@@ -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"));
}

0 comments on commit 0a53c89

Please sign in to comment.