diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a58b66c..e3e4e8d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,5 @@ -name: Run tests +name: "Test" + on: workflow_dispatch: push: @@ -7,18 +8,78 @@ on: pull_request: jobs: - run: - runs-on: ubuntu-latest + check: + name: "Cargo check" + runs-on: "ubuntu-latest" + steps: + - name: "Check out the repo" + uses: actions/checkout@v3 + + - uses: "actions-rs/toolchain@v1" + with: + profile: "minimal" + toolchain: "stable" + override: true + + - uses: "actions-rs/cargo@v1" + with: + command: "check" + args: "--release" + + test: + name: "Cargo test" + runs-on: "ubuntu-latest" + steps: + - name: "Check out the repo" + uses: actions/checkout@v3 + + - uses: "actions-rs/toolchain@v1" + with: + profile: "minimal" + toolchain: "stable" + override: true + + - uses: "actions-rs/cargo@v1" + with: + command: "test" + args: "--test-threads=1" + + fmt: + name: "Cargo format" + runs-on: "ubuntu-latest" + steps: + - name: "Check out the repo" + uses: actions/checkout@v3 + + - uses: "actions-rs/toolchain@v1" + with: + profile: "minimal" + toolchain: "stable" + override: true + + - run: "rustup component add rustfmt" + + - uses: "actions-rs/cargo@v1" + with: + command: "fmt" + args: "--all -- --check" + + clippy: + name: "Cargo clippy" + runs-on: "ubuntu-latest" steps: - # Checkout repo - - name: Fetch the repository code - uses: actions/checkout@v4 + - name: "Check out the repo" + uses: actions/checkout@v3 - - name: Deny banned crates and licenses - uses: EmbarkStudios/cargo-deny-action@v1 + - uses: "actions-rs/toolchain@v1" + with: + profile: "minimal" + toolchain: "stable" + override: true - - name: Build Docker image - run: docker build . -t tinty + - run: "rustup component add clippy" - - name: Run Docker container - run: docker run tinty + - uses: "actions-rs/cargo@v1" + with: + command: "clippy" + args: "-- -D warnings" diff --git a/src/operations/set.rs b/src/operations/set.rs index a41e081..013042b 100644 --- a/src/operations/set.rs +++ b/src/operations/set.rs @@ -60,7 +60,9 @@ pub fn set(config_path: &Path, data_path: &Path, full_scheme_name: &str) -> Resu // Collect config items that match the provided system let system_items = items.iter().filter(|item| match &item.supported_systems { - Some(supported_systems) => supported_systems.contains(&SupportedSchemeSystems::from_str(scheme_system)), + Some(supported_systems) => { + supported_systems.contains(&SupportedSchemeSystems::from_str(scheme_system)) + } None => false, }); diff --git a/tests/cli_set_subcommand_tests.rs b/tests/cli_set_subcommand_tests.rs index 3a525ce..3845da5 100644 --- a/tests/cli_set_subcommand_tests.rs +++ b/tests/cli_set_subcommand_tests.rs @@ -1,7 +1,7 @@ mod common; use crate::common::{cleanup, COMMAND_NAME, REPO_NAME}; -use anyhow::{Result, anyhow}; +use anyhow::{anyhow, Result}; use std::fs; use std::path::{Path, PathBuf};