Skip to content

Commit

Permalink
Update "Test" workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JamyGolden committed Feb 15, 2024
1 parent c815d30 commit 8f26ab6
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 14 deletions.
85 changes: 73 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Run tests
name: "Test"

on:
workflow_dispatch:
push:
Expand All @@ -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"
4 changes: 3 additions & 1 deletion src/operations/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand Down
2 changes: 1 addition & 1 deletion tests/cli_set_subcommand_tests.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down

0 comments on commit 8f26ab6

Please sign in to comment.