From 853245fe0e10029ecc0c1040f53ac179e394b5f5 Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 00:20:55 -0600 Subject: [PATCH 01/12] remove test extra mod --- .github/workflows/test.yaml | 2 +- src/tests/integration.rs | 39 ++++--- src/tests/unit.rs | 203 ++++++++++++++++++------------------ 3 files changed, 119 insertions(+), 125 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8740716..799f859 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -36,4 +36,4 @@ jobs: ${{ runner.os }}-cargo-build- - name: Run Tests - run: cargo test + run: cargo test --color always diff --git a/src/tests/integration.rs b/src/tests/integration.rs index d945133..c8b3759 100644 --- a/src/tests/integration.rs +++ b/src/tests/integration.rs @@ -1,32 +1,29 @@ use crate::*; #[cfg(test)] -mod integration { - use super::*; - #[test] - fn test_filter() { - let arg = "--patterns=*.rs,!*..txt"; - let files = vec![ - String::from("src/main.rs"), - String::from("lib.rs"), - String::from("test.txt"), - ]; +#[test] +fn test_filter() { + let arg = "--patterns=*.rs,!*..txt"; + let files = vec![ + String::from("src/main.rs"), + String::from("lib.rs"), + String::from("test.txt"), + ]; - let filters = create_patterns_filters(arg); + let filters = create_patterns_filters(arg); - let (include_patterns_filters, exclude_patterns_filters) = categorize_filters(filters); + let (include_patterns_filters, exclude_patterns_filters) = categorize_filters(filters); - let filtered_files = filter_files(files, include_patterns_filters, exclude_patterns_filters); + let filtered_files = filter_files(files, include_patterns_filters, exclude_patterns_filters); - let count = get_count(filtered_files.clone()); + let count = get_count(filtered_files.clone()); - let expected_filtered_files = HashSet::from([ - String::from("src/main.rs"), - String::from("lib.rs"), - ]); + let expected_filtered_files = HashSet::from([ + String::from("src/main.rs"), + String::from("lib.rs"), + ]); - assert_eq!(filtered_files, expected_filtered_files); - assert_eq!(count, 2); - } + assert_eq!(filtered_files, expected_filtered_files); + assert_eq!(count, 2); } diff --git a/src/tests/unit.rs b/src/tests/unit.rs index 9377ca5..07bdee4 100644 --- a/src/tests/unit.rs +++ b/src/tests/unit.rs @@ -1,118 +1,115 @@ use crate::*; #[cfg(test)] -mod unit { - use super::*; - #[test] - fn test_create_patterns_filters_single_line() { - let arg = "--patterns=*.rs,!test/*.rs"; - let filters = create_patterns_filters(arg); - assert_eq!(filters.len(), 2); - assert_eq!(filters[0].pattern, "*.rs"); - assert_eq!( - filters[0].exclude, false, - "Expected 'exclude' to be false for pattern '*.rs'" - ); - assert_eq!(filters[1].pattern, "test/*.rs"); - assert_eq!(filters[1].exclude, true); - } +#[test] +fn test_create_patterns_filters_single_line() { + let arg = "--patterns=*.rs,!test/*.rs"; + let filters = create_patterns_filters(arg); + assert_eq!(filters.len(), 2); + assert_eq!(filters[0].pattern, "*.rs"); + assert_eq!( + filters[0].exclude, false, + "Expected 'exclude' to be false for pattern '*.rs'" + ); + assert_eq!(filters[1].pattern, "test/*.rs"); + assert_eq!(filters[1].exclude, true); +} - #[test] - fn test_create_patterns_filters_multiple_lines() { - let arg = "--patterns=*.rs - !test/*.rs - .gitignore - "; - let filters = create_patterns_filters(arg); +#[test] +fn test_create_patterns_filters_multiple_lines() { + let arg = "--patterns=*.rs + !test/*.rs + .gitignore + "; + let filters = create_patterns_filters(arg); - assert_eq!(filters.len(), 3); - assert_eq!(filters[0].pattern, "*.rs"); - assert_eq!(filters[0].exclude, false); - assert_eq!(filters[1].pattern, "test/*.rs"); - assert_eq!(filters[1].exclude, true); - assert_eq!(filters[2].pattern, ".gitignore"); - assert_eq!(filters[2].exclude, false); - } + assert_eq!(filters.len(), 3); + assert_eq!(filters[0].pattern, "*.rs"); + assert_eq!(filters[0].exclude, false); + assert_eq!(filters[1].pattern, "test/*.rs"); + assert_eq!(filters[1].exclude, true); + assert_eq!(filters[2].pattern, ".gitignore"); + assert_eq!(filters[2].exclude, false); +} - #[test] - fn test_categorize_filters() { - let filters = vec![ - PatternFilter { - pattern: String::from("*.rs"), - exclude: false, - }, - PatternFilter { - pattern: String::from("test/*.rs"), - exclude: true, - }, - ]; - let (include_patterns_filters, exclude_patterns_filters) = categorize_filters(filters); - assert_eq!(include_patterns_filters.len(), 1); - assert_eq!(exclude_patterns_filters.len(), 1); - assert_eq!(include_patterns_filters.contains("*.rs"), true); - assert_eq!(exclude_patterns_filters.contains("test/*.rs"), true); - } +#[test] +fn test_categorize_filters() { + let filters = vec![ + PatternFilter { + pattern: String::from("*.rs"), + exclude: false, + }, + PatternFilter { + pattern: String::from("test/*.rs"), + exclude: true, + }, + ]; + let (include_patterns_filters, exclude_patterns_filters) = categorize_filters(filters); + assert_eq!(include_patterns_filters.len(), 1); + assert_eq!(exclude_patterns_filters.len(), 1); + assert_eq!(include_patterns_filters.contains("*.rs"), true); + assert_eq!(exclude_patterns_filters.contains("test/*.rs"), true); +} - #[test] - fn test_filter() { - let files = vec![ - String::from("src/main.rs"), - String::from("lib.rs"), - String::from("test.txt"), - ]; - let include_patterns_filters = HashSet::from([ - String::from("*.rs"), - String::from("src/**"), - String::from("*.txt"), - ]); - let exclude_patterns_filters = HashSet::from([ - String::from("test.txt") - ]); - let filtered_files = filter_files(files, include_patterns_filters, exclude_patterns_filters); - let expected_filtered_files = HashSet::from([ - String::from("src/main.rs"), - String::from("lib.rs"), - ]); +#[test] +fn test_filter() { + let files = vec![ + String::from("src/main.rs"), + String::from("lib.rs"), + String::from("test.txt"), + ]; + let include_patterns_filters = HashSet::from([ + String::from("*.rs"), + String::from("src/**"), + String::from("*.txt"), + ]); + let exclude_patterns_filters = HashSet::from([ + String::from("test.txt") + ]); + let filtered_files = filter_files(files, include_patterns_filters, exclude_patterns_filters); + let expected_filtered_files = HashSet::from([ + String::from("src/main.rs"), + String::from("lib.rs"), + ]); - assert_eq!(filtered_files, expected_filtered_files); - } + assert_eq!(filtered_files, expected_filtered_files); +} - #[test] - fn test_filter_exclude_files_exclusion() { - let exclude_patterns_filters = HashSet::from([ - String::from("test.txt"), - ]); - let include_patterns_filters = HashSet::from([ - String::from("*.rs"), - String::from("*.txt"), - ]); +#[test] +fn test_filter_exclude_files_exclusion() { + let exclude_patterns_filters = HashSet::from([ + String::from("test.txt"), + ]); + let include_patterns_filters = HashSet::from([ + String::from("*.rs"), + String::from("*.txt"), + ]); - let files = vec![ - String::from("main.rs"), - String::from("lib.rs"), - String::from("version.txt"), - String::from("test.txt"), - ]; + let files = vec![ + String::from("main.rs"), + String::from("lib.rs"), + String::from("version.txt"), + String::from("test.txt"), + ]; - let filtered_files = filter_files(files, include_patterns_filters, exclude_patterns_filters); - let expected_filtered_files = HashSet::from([ - String::from("main.rs"), - String::from("lib.rs"), - String::from("version.txt"), - ]); + let filtered_files = filter_files(files, include_patterns_filters, exclude_patterns_filters); + let expected_filtered_files = HashSet::from([ + String::from("main.rs"), + String::from("lib.rs"), + String::from("version.txt"), + ]); - assert_eq!(filtered_files, expected_filtered_files); - } + assert_eq!(filtered_files, expected_filtered_files); +} - #[test] - fn test_get_count() { - let files = HashSet::from([ - String::from("main.rs"), - String::from("lib.rs"), - String::from("version.txt"), - ]); - let count = get_count(files); - assert_eq!(count, 3); - } +#[test] +fn test_get_count() { + let files = HashSet::from([ + String::from("main.rs"), + String::from("lib.rs"), + String::from("version.txt"), + ]); + let count = get_count(files); + assert_eq!(count, 3); } From 594609c8c4f4f5e4ef003b1101d6fbb7699fea0f Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 00:42:36 -0600 Subject: [PATCH 02/12] clippy test --- .github/workflows/clippy.yaml | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/clippy.yaml diff --git a/.github/workflows/clippy.yaml b/.github/workflows/clippy.yaml new file mode 100644 index 0000000..b2b3234 --- /dev/null +++ b/.github/workflows/clippy.yaml @@ -0,0 +1,54 @@ +name: Clippy Test + +on: + pull_request: + + +jobs: + git-diff: + runs-on: ubuntu-latest + name: 'Git Diff - Powered by Rust' + outputs: + DIFF_FILES: ${{ steps.git-diff.outputs.DIFF_FILES }} + DIFF_COUNT: ${{ steps.git-diff.outputs.DIFF_COUNT }} + steps: + - uses: actions/checkout@v4 + - uses: LuisLiraC/git-diff@v1.0.2 + id: git-diff + with: + patterns: '*.rs' + + clippy-test: + runs-on: ubuntu-latest + needs: [git-diff] + if: ${{ needs.git-diff.outputs.DIFF_COUNT != 0 }} + name: Run Tests + steps: + - uses: actions/checkout@v4 + + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache cargo index + uses: actions/cache@v4 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-index- + + - name: Cache cargo build + uses: actions/cache@v4 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-build- + + - name: Run Tests + run: cargo clippy --color always -- -Dwarnings -W clippy::pedantic From b13dba47e763a907b3c930534eae6f7faf55f242 Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 00:51:07 -0600 Subject: [PATCH 03/12] fix clippy: needless_pass_by_value --- src/main.rs | 14 +++++++------- src/tests/integration.rs | 6 +++--- src/tests/unit.rs | 18 +++++++++--------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2e3b9f5..d2e0391 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,7 @@ fn main() { for arg in args.iter() { if arg.starts_with("--patterns=") { - patterns_filters = create_patterns_filters(&arg); + patterns_filters = create_patterns_filters(arg); } } @@ -26,7 +26,7 @@ fn main() { return; } - let (include_patterns_filters, exclude_patterns_filters) = categorize_filters(patterns_filters); + let (include_patterns_filters, exclude_patterns_filters) = categorize_filters(&patterns_filters); let start = Instant::now(); let changed_files = get_changed_files(); @@ -36,11 +36,11 @@ fn main() { println!("Changed files: {:?}", changed_files); let start = Instant::now(); - let filtered_files = filter_files(changed_files, include_patterns_filters, exclude_patterns_filters); + let filtered_files = filter_files(&changed_files, &include_patterns_filters, &exclude_patterns_filters); let duration = start.elapsed(); println!("Filtering files done in: {:?}", duration); - let count = get_count(filtered_files.clone()); + let count = get_count(&filtered_files); println!("Filtered files: {:?}", filtered_files); println!("Count: {}", count); @@ -134,7 +134,7 @@ fn get_changed_files() -> Vec { changed_files } -fn filter_files(changed_files: Vec, include_patterns_filters: HashSet, exclude_patterns_filters: HashSet) -> HashSet { +fn filter_files(changed_files: &Vec, include_patterns_filters: &HashSet, exclude_patterns_filters: &HashSet) -> HashSet { let mut hash_set_filtered_files = HashSet::new(); for changed_file in changed_files.iter() { @@ -154,11 +154,11 @@ fn filter_files(changed_files: Vec, include_patterns_filters: HashSet) -> usize { +fn get_count(filtered_files: &HashSet) -> usize { filtered_files.len() } -fn categorize_filters(filters: Vec) -> (HashSet, HashSet) { +fn categorize_filters(filters: &Vec) -> (HashSet, HashSet) { let mut exclude_patterns_filters: HashSet = HashSet::new(); let mut include_patterns_filters: HashSet = HashSet::new(); diff --git a/src/tests/integration.rs b/src/tests/integration.rs index c8b3759..b779997 100644 --- a/src/tests/integration.rs +++ b/src/tests/integration.rs @@ -13,11 +13,11 @@ fn test_filter() { let filters = create_patterns_filters(arg); - let (include_patterns_filters, exclude_patterns_filters) = categorize_filters(filters); + let (include_patterns_filters, exclude_patterns_filters) = categorize_filters(&filters); - let filtered_files = filter_files(files, include_patterns_filters, exclude_patterns_filters); + let filtered_files = filter_files(&files, &include_patterns_filters, &exclude_patterns_filters); - let count = get_count(filtered_files.clone()); + let count = get_count(&filtered_files); let expected_filtered_files = HashSet::from([ String::from("src/main.rs"), diff --git a/src/tests/unit.rs b/src/tests/unit.rs index 07bdee4..05bb958 100644 --- a/src/tests/unit.rs +++ b/src/tests/unit.rs @@ -26,11 +26,11 @@ fn test_create_patterns_filters_multiple_lines() { assert_eq!(filters.len(), 3); assert_eq!(filters[0].pattern, "*.rs"); - assert_eq!(filters[0].exclude, false); + assert!(!filters[0].exclude); assert_eq!(filters[1].pattern, "test/*.rs"); - assert_eq!(filters[1].exclude, true); + assert!(filters[1].exclude); assert_eq!(filters[2].pattern, ".gitignore"); - assert_eq!(filters[2].exclude, false); + assert!(!filters[2].exclude); } #[test] @@ -45,11 +45,11 @@ fn test_categorize_filters() { exclude: true, }, ]; - let (include_patterns_filters, exclude_patterns_filters) = categorize_filters(filters); + let (include_patterns_filters, exclude_patterns_filters) = categorize_filters(&filters); assert_eq!(include_patterns_filters.len(), 1); assert_eq!(exclude_patterns_filters.len(), 1); - assert_eq!(include_patterns_filters.contains("*.rs"), true); - assert_eq!(exclude_patterns_filters.contains("test/*.rs"), true); + assert!(include_patterns_filters.contains("*.rs")); + assert!(exclude_patterns_filters.contains("test/*.rs")); } #[test] @@ -67,7 +67,7 @@ fn test_filter() { let exclude_patterns_filters = HashSet::from([ String::from("test.txt") ]); - let filtered_files = filter_files(files, include_patterns_filters, exclude_patterns_filters); + let filtered_files = filter_files(&files, &include_patterns_filters, &exclude_patterns_filters); let expected_filtered_files = HashSet::from([ String::from("src/main.rs"), String::from("lib.rs"), @@ -93,7 +93,7 @@ fn test_filter_exclude_files_exclusion() { String::from("test.txt"), ]; - let filtered_files = filter_files(files, include_patterns_filters, exclude_patterns_filters); + let filtered_files = filter_files(&files, &include_patterns_filters, &exclude_patterns_filters); let expected_filtered_files = HashSet::from([ String::from("main.rs"), String::from("lib.rs"), @@ -110,6 +110,6 @@ fn test_get_count() { String::from("lib.rs"), String::from("version.txt"), ]); - let count = get_count(files); + let count = get_count(&files); assert_eq!(count, 3); } From 4be598e8fadb26127949efb6fc7777dbf41b95a7 Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 00:55:22 -0600 Subject: [PATCH 04/12] fix clippy: explicit_iter_loop --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index d2e0391..5b90fb8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,7 +15,7 @@ fn main() { let args: Vec = env::args().collect(); let mut patterns_filters: Vec = Vec::new(); - for arg in args.iter() { + for arg in &args { if arg.starts_with("--patterns=") { patterns_filters = create_patterns_filters(arg); } @@ -76,7 +76,7 @@ fn create_patterns_filters(arg: &str) -> Vec { let mut patterns_filters: Vec = Vec::new(); - for pattern in patterns.iter() { + for pattern in &patterns { let exclude = pattern.starts_with('!'); let pattern = if exclude { pattern[1..].to_string() @@ -137,7 +137,7 @@ fn get_changed_files() -> Vec { fn filter_files(changed_files: &Vec, include_patterns_filters: &HashSet, exclude_patterns_filters: &HashSet) -> HashSet { let mut hash_set_filtered_files = HashSet::new(); - for changed_file in changed_files.iter() { + for changed_file in changed_files { include_patterns_filters.iter().for_each(|pattern| { if Pattern::new(pattern).expect("Failed to create pattern").matches(changed_file) { hash_set_filtered_files.insert(changed_file.to_string()); From 9673e8c3f027c0015e086cef41fcf4063e89177a Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 00:58:58 -0600 Subject: [PATCH 05/12] fix clippy: uninlined_format_args --- src/main.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5b90fb8..3ae0c09 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,29 +31,29 @@ fn main() { let start = Instant::now(); let changed_files = get_changed_files(); let duration = start.elapsed(); - println!("Getting changed files done in: {:?}", duration); + println!("Getting changed files done in: {duration:?}"); - println!("Changed files: {:?}", changed_files); + println!("Changed files: {changed_files:?}"); let start = Instant::now(); let filtered_files = filter_files(&changed_files, &include_patterns_filters, &exclude_patterns_filters); let duration = start.elapsed(); - println!("Filtering files done in: {:?}", duration); + println!("Filtering files done in: {duration:?}"); let count = get_count(&filtered_files); - println!("Filtered files: {:?}", filtered_files); - println!("Count: {}", count); + println!("Filtered files: {filtered_files:?}"); + println!("Count: {count}"); Command::new("sh") .arg("-c") - .arg(format!("echo \"DIFF_FILES={:?}\" >> $GITHUB_OUTPUT", filtered_files)) + .arg(format!("echo \"DIFF_FILES={filtered_files:?}\" >> $GITHUB_OUTPUT")) .output() .expect("Failed to execute DIFF_FILES command"); Command::new("sh") .arg("-c") - .arg(format!("echo \"DIFF_COUNT={}\" >> $GITHUB_OUTPUT", count)) + .arg(format!("echo \"DIFF_COUNT={count}\" >> $GITHUB_OUTPUT")) .output() .expect("Failed to execute DIFF_COUNT command"); } @@ -104,11 +104,11 @@ fn get_changed_files() -> Vec { Command::new("sh") .arg("-c") - .arg(format!("git fetch origin {}", base_ref_env)) + .arg(format!("git fetch origin {base_ref_env}")) .output() .expect("Failed to execute fetch branch command"); - let base_ref_string = format!("refs/remotes/origin/{}", base_ref_env); + let base_ref_string = format!("refs/remotes/origin/{base_ref_env}"); let base_ref = repository.find_reference(&base_ref_string).expect("Failed to find default branch"); let base_commit = base_ref.peel_to_commit().expect("Failed to peel default branch to commit"); From 68689320eaef80d85d9f1451056215bb6f9bd329 Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 01:03:08 -0600 Subject: [PATCH 06/12] fix clippy: needless_for_each --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3ae0c09..ca52a99 100644 --- a/src/main.rs +++ b/src/main.rs @@ -138,17 +138,17 @@ fn filter_files(changed_files: &Vec, include_patterns_filters: &HashSet< let mut hash_set_filtered_files = HashSet::new(); for changed_file in changed_files { - include_patterns_filters.iter().for_each(|pattern| { + for pattern in include_patterns_filters { if Pattern::new(pattern).expect("Failed to create pattern").matches(changed_file) { hash_set_filtered_files.insert(changed_file.to_string()); } - exclude_patterns_filters.iter().for_each(|pattern| { + for pattern in exclude_patterns_filters { if Pattern::new(pattern).expect("Failed to create pattern").matches(changed_file) { hash_set_filtered_files.remove(changed_file); } - }); - }); + } + } } hash_set_filtered_files @@ -162,13 +162,13 @@ fn categorize_filters(filters: &Vec) -> (HashSet, HashSet let mut exclude_patterns_filters: HashSet = HashSet::new(); let mut include_patterns_filters: HashSet = HashSet::new(); - filters.iter().for_each(|pattern_filter| { + for pattern_filter in filters { if pattern_filter.exclude { exclude_patterns_filters.insert(pattern_filter.clone().pattern); } else { include_patterns_filters.insert(pattern_filter.clone().pattern); } - }); + } (include_patterns_filters, exclude_patterns_filters) } From c1e8b7c86b743a47443cae6b4d92430a9b81ca03 Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 01:04:42 -0600 Subject: [PATCH 07/12] fix clippy: single_char_pattern --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index ca52a99..18e3ae0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,9 +63,9 @@ fn create_patterns_filters(arg: &str) -> Vec { .split('=') .last() .expect("Failed to get patterns") - .replace(" ", "") - .replace("\n", ",") - .replace("\r", "") + .replace(' ', "") + .replace('\n', ",") + .replace('\r', "") .replace(",,", ",") .trim_end_matches(',') .to_string(); From d07fbabf081e61f9f2a974d13841e27fd90a4175 Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 01:05:56 -0600 Subject: [PATCH 08/12] fix clippy: inefficient_to_string --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 18e3ae0..4f986fd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,7 +81,7 @@ fn create_patterns_filters(arg: &str) -> Vec { let pattern = if exclude { pattern[1..].to_string() } else { - pattern.to_string() + (*pattern).to_string() }; patterns_filters.push(PatternFilter { From a2fcdb9592bcb7bf88a98ec4ca3f0c9447580ad2 Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 01:06:32 -0600 Subject: [PATCH 09/12] prepare to prerelease --- action.yaml | 2 +- version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yaml b/action.yaml index 23c919c..e1e9200 100644 --- a/action.yaml +++ b/action.yaml @@ -20,7 +20,7 @@ runs: - name: Get Binary shell: bash run: | - BIN_URL=$(curl https://api.github.com/repos/LuisLiraC/git-diff/releases/tags/v1.0.2 | jq -r '.assets[0].browser_download_url') + BIN_URL=$(curl https://api.github.com/repos/LuisLiraC/git-diff/releases/tags/v1.0.3-prerelease | jq -r '.assets[0].browser_download_url') curl -s -L $BIN_URL -o rust-binary.tgz tar -xzvf rust-binary.tgz mv ./Linux/git-diff ./git-diff diff --git a/version b/version index b482243..13637f4 100644 --- a/version +++ b/version @@ -1 +1 @@ -v1.0.2 \ No newline at end of file +v1.0.3 \ No newline at end of file From aa72a58eddf7efdd471ee6b6942e67e8caf1caa8 Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 01:08:12 -0600 Subject: [PATCH 10/12] color always on build bins --- .github/workflows/prerelease.yaml | 2 +- .github/workflows/release.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prerelease.yaml b/.github/workflows/prerelease.yaml index 4dfaaad..51b1bb9 100644 --- a/.github/workflows/prerelease.yaml +++ b/.github/workflows/prerelease.yaml @@ -40,7 +40,7 @@ jobs: ${{ runner.os }}-cargo-build- - name: Build - run: cargo build --release + run: cargo build --release --color always - name: Create Archive Folder run: mkdir ${{ runner.os }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9cfe617..f59aa9c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -40,7 +40,7 @@ jobs: ${{ runner.os }}-cargo-build- - name: Build - run: cargo build --release + run: cargo build --release --color always - name: Create Archive Folder run: mkdir ${{ runner.os }} From 554cd124fadebc5392c8b978da8a5118f840d86b Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 01:11:16 -0600 Subject: [PATCH 11/12] run unit test only in *.rs changes --- .github/workflows/test.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 799f859..e7a2b50 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,8 +5,23 @@ on: jobs: + git-diff: + runs-on: ubuntu-latest + name: 'Git Diff - Powered by Rust' + outputs: + DIFF_FILES: ${{ steps.git-diff.outputs.DIFF_FILES }} + DIFF_COUNT: ${{ steps.git-diff.outputs.DIFF_COUNT }} + steps: + - uses: actions/checkout@v4 + - uses: LuisLiraC/git-diff@v1.0.2 + id: git-diff + with: + patterns: '*.rs' + test: runs-on: ubuntu-latest + needs: [git-diff] + if: ${{ needs.git-diff.outputs.DIFF_COUNT != 0 }} name: Run Tests steps: - uses: actions/checkout@v4 From 4e24cbef01a22a37c4148936c94430cbb234229b Mon Sep 17 00:00:00 2001 From: LuisLiraC Date: Sun, 15 Sep 2024 01:16:27 -0600 Subject: [PATCH 12/12] prepare action for release v1.0.3 --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index e1e9200..6beafdd 100644 --- a/action.yaml +++ b/action.yaml @@ -20,7 +20,7 @@ runs: - name: Get Binary shell: bash run: | - BIN_URL=$(curl https://api.github.com/repos/LuisLiraC/git-diff/releases/tags/v1.0.3-prerelease | jq -r '.assets[0].browser_download_url') + BIN_URL=$(curl https://api.github.com/repos/LuisLiraC/git-diff/releases/tags/v1.0.3 | jq -r '.assets[0].browser_download_url') curl -s -L $BIN_URL -o rust-binary.tgz tar -xzvf rust-binary.tgz mv ./Linux/git-diff ./git-diff