Compare commits

..

9 Commits

Author SHA1 Message Date
4cd47a3509 Merge pull request 'add basic rust ci using task' (#1) from gitea_ci into main
Some checks failed
Build and Release Formaty / build (release) Failing after 7s
Build and Test Formaty / build (push) Successful in 1m10s
Reviewed-on: #1
2026-03-22 22:56:53 +00:00
8d1e476cbe
add release job
All checks were successful
Build and Test Formaty / build (push) Successful in 1m8s
2026-03-22 16:49:07 -06:00
57cc47e603
try and use the fork to get around ghes issues
All checks were successful
Build and Test Formaty / build (push) Successful in 1m19s
2026-03-22 16:40:37 -06:00
577121be93
bump upload-artifact version
Some checks failed
Build and Test Formaty / build (push) Failing after 1m22s
2026-03-22 16:32:14 -06:00
ec12552c08
publish built binary, fix duplicate run
Some checks failed
Build and Test Formaty / build (push) Failing after 1m21s
2026-03-22 15:28:16 -06:00
41b31860ca
allow tests to pass if global config dir can't be found or made
All checks were successful
Build and Test Formaty / build (pull_request) Successful in 1m5s
Build and Test Formaty / build (push) Successful in 1m7s
2026-03-22 15:17:55 -06:00
a1c8b4a8db
set a github api token
Some checks failed
Build and Test Formaty / build (pull_request) Failing after 1m2s
Build and Test Formaty / build (push) Failing after 1m4s
2026-03-22 15:01:10 -06:00
1e82607e36
bump task action version
Some checks failed
Build and Test Formaty / build (push) Failing after 20s
Build and Test Formaty / build (pull_request) Failing after 19s
2026-03-22 14:49:10 -06:00
e2eceeb13a
add basic rust ci using task
Some checks failed
Build and Test Formaty / build (push) Failing after 1m49s
Build and Test Formaty / build (pull_request) Failing after 1m43s
2026-03-22 14:43:17 -06:00
3 changed files with 62 additions and 9 deletions

View File

@ -0,0 +1,29 @@
name: Build and Test Formaty
on: [push]
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
components: rustfmt, clippy
- name: Lint Code
run: task check
- name: Build
run: task build
- name: Run Unit Tests
run: task test
- name: Upload Built Binary
uses: christopherHX/gitea-upload-artifact@v4
with:
name: formaty
path: target/debug/formaty

View File

@ -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

View File

@ -7,7 +7,7 @@ use serde::Deserialize;
use std::fs::{File, read_dir}; use std::fs::{File, read_dir};
use std::io::Read; use std::io::Read;
use std::path::PathBuf; use std::path::PathBuf;
use std::{fs, str}; use std::str;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "formats/"] #[folder = "formats/"]
@ -95,19 +95,19 @@ impl FormatConfig {
config.get_file_config(config_path)?; config.get_file_config(config_path)?;
let global_dir = match global_config_path { let global_dir = match global_config_path {
Some(g) => g.clone(), Some(g) => Some(g.clone()),
None => { None => {
let app_dirs = AppDirs::new(Some("formaty"), true).unwrap(); if let Some(app_dirs) = AppDirs::new(Some("formaty"), true)
&& app_dirs.config_dir.exists()
if !app_dirs.config_dir.exists() { {
fs::create_dir(&app_dirs.config_dir)?; Some(app_dirs.config_dir)
} else {
None
} }
app_dirs.config_dir
} }
}; };
config.parse_directory(&Some(global_dir))?; config.parse_directory(&global_dir)?;
Ok(config) Ok(config)
} }