From e2eceeb13a358b96d776c476ee6ab16650a1cb6c Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 22 Mar 2026 14:43:17 -0600 Subject: [PATCH 1/8] add basic rust ci using task --- .gitea/workflows/rust.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .gitea/workflows/rust.yaml diff --git a/.gitea/workflows/rust.yaml b/.gitea/workflows/rust.yaml new file mode 100644 index 0000000..feeafad --- /dev/null +++ b/.gitea/workflows/rust.yaml @@ -0,0 +1,22 @@ +name: Build and Test Formaty +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install Task + uses: go-task/setup-task@v1 + - uses: actions/checkout@v2 + - name: Stable with rustfmt and clippy + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + components: rustfmt, clippy + - name: Lint Code + run: task check + - name: Build + run: task build + - name: Run Unit Tests + run: task test -- 2.47.1 From 1e82607e3696479aaa5ab3502129f639d2506e63 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 22 Mar 2026 14:49:10 -0600 Subject: [PATCH 2/8] bump task action version --- .gitea/workflows/rust.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/rust.yaml b/.gitea/workflows/rust.yaml index feeafad..652a58b 100644 --- a/.gitea/workflows/rust.yaml +++ b/.gitea/workflows/rust.yaml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Task - uses: go-task/setup-task@v1 + uses: go-task/setup-task@v2 - uses: actions/checkout@v2 - name: Stable with rustfmt and clippy uses: actions-rs/toolchain@v1 -- 2.47.1 From a1c8b4a8dbb8652df069b7505c180a88fe273f96 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 22 Mar 2026 15:01:10 -0600 Subject: [PATCH 3/8] set a github api token --- .gitea/workflows/rust.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/rust.yaml b/.gitea/workflows/rust.yaml index 652a58b..933668f 100644 --- a/.gitea/workflows/rust.yaml +++ b/.gitea/workflows/rust.yaml @@ -7,6 +7,8 @@ jobs: steps: - name: Install Task uses: go-task/setup-task@v2 + with: + repo-token: ${{ secrets.TASK_GITHUB_API_TOKEN }} - uses: actions/checkout@v2 - name: Stable with rustfmt and clippy uses: actions-rs/toolchain@v1 -- 2.47.1 From 41b31860cac59deca116922f526806982a66a21f Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 22 Mar 2026 15:17:55 -0600 Subject: [PATCH 4/8] allow tests to pass if global config dir can't be found or made --- src/formatter/format_config.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/formatter/format_config.rs b/src/formatter/format_config.rs index bcce855..727540a 100644 --- a/src/formatter/format_config.rs +++ b/src/formatter/format_config.rs @@ -7,7 +7,7 @@ use serde::Deserialize; use std::fs::{File, read_dir}; use std::io::Read; use std::path::PathBuf; -use std::{fs, str}; +use std::str; #[derive(RustEmbed)] #[folder = "formats/"] @@ -95,19 +95,19 @@ impl FormatConfig { config.get_file_config(config_path)?; let global_dir = match global_config_path { - Some(g) => g.clone(), + Some(g) => Some(g.clone()), None => { - let app_dirs = AppDirs::new(Some("formaty"), true).unwrap(); - - if !app_dirs.config_dir.exists() { - fs::create_dir(&app_dirs.config_dir)?; + if let Some(app_dirs) = AppDirs::new(Some("formaty"), true) + && app_dirs.config_dir.exists() + { + Some(app_dirs.config_dir) + } else { + None } - - app_dirs.config_dir } }; - config.parse_directory(&Some(global_dir))?; + config.parse_directory(&global_dir)?; Ok(config) } -- 2.47.1 From ec12552c080d1fbb64577c0beda6db0f739aa524 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 22 Mar 2026 15:28:16 -0600 Subject: [PATCH 5/8] publish built binary, fix duplicate run --- .gitea/workflows/{rust.yaml => build.yaml} | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) rename .gitea/workflows/{rust.yaml => build.yaml} (78%) diff --git a/.gitea/workflows/rust.yaml b/.gitea/workflows/build.yaml similarity index 78% rename from .gitea/workflows/rust.yaml rename to .gitea/workflows/build.yaml index 933668f..ecd761d 100644 --- a/.gitea/workflows/rust.yaml +++ b/.gitea/workflows/build.yaml @@ -1,5 +1,5 @@ name: Build and Test Formaty -on: [push, pull_request] +on: [push] jobs: build: @@ -22,3 +22,8 @@ jobs: run: task build - name: Run Unit Tests run: task test + - name: Upload Built Binary + uses: actions/upload-artifact@v4 + with: + name: formaty + path: target/debug/formaty -- 2.47.1 From 577121be93f7ff2caf5f32a1026de400c6eb3556 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 22 Mar 2026 16:32:14 -0600 Subject: [PATCH 6/8] bump upload-artifact version --- .gitea/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index ecd761d..b0ba842 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -23,7 +23,7 @@ jobs: - name: Run Unit Tests run: task test - name: Upload Built Binary - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: formaty path: target/debug/formaty -- 2.47.1 From 57cc47e603af04ac124453dd48f90f0037a2f920 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 22 Mar 2026 16:40:37 -0600 Subject: [PATCH 7/8] try and use the fork to get around ghes issues --- .gitea/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index b0ba842..9506e7f 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -23,7 +23,7 @@ jobs: - name: Run Unit Tests run: task test - name: Upload Built Binary - uses: actions/upload-artifact@v6 + uses: christopherHX/gitea-upload-artifact@v4 with: name: formaty path: target/debug/formaty -- 2.47.1 From 8d1e476cbea5e7861363d7da0719e3fa7c08ab03 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 22 Mar 2026 16:49:07 -0600 Subject: [PATCH 8/8] add release job --- .gitea/workflows/release.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..63e00af --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,24 @@ +name: Build and Release Formaty +on: [release] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install Task + uses: go-task/setup-task@v2 + with: + repo-token: ${{ secrets.TASK_GITHUB_API_TOKEN }} + - uses: actions/checkout@v2 + - name: Stable with rustfmt and clippy + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - name: Build Release + run: task build:release + - uses: actions/gitea-release-action@v1 + with: + files: |- + target/release/formaty + -- 2.47.1