12 Commits
Author SHA1 Message Date
joeyahines 572993a5e6 specify url on gitea release
Build and Release Formaty / build (release) Successful in 55s
Build and Test Formaty / build (push) Successful in 1m10s
2026-03-22 17:04:28 -06:00
joeyahines 4cd47a3509 Merge pull request 'add basic rust ci using task' (#1) from gitea_ci into main
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
joeyahines 8d1e476cbe add release job
Build and Test Formaty / build (push) Successful in 1m8s
2026-03-22 16:49:07 -06:00
joeyahines 57cc47e603 try and use the fork to get around ghes issues
Build and Test Formaty / build (push) Successful in 1m19s
2026-03-22 16:40:37 -06:00
joeyahines 577121be93 bump upload-artifact version
Build and Test Formaty / build (push) Failing after 1m22s
2026-03-22 16:32:14 -06:00
joeyahines ec12552c08 publish built binary, fix duplicate run
Build and Test Formaty / build (push) Failing after 1m21s
2026-03-22 15:28:16 -06:00
joeyahines 41b31860ca allow tests to pass if global config dir can't be found or made
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
joeyahines a1c8b4a8db set a github api token
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
joeyahines 1e82607e36 bump task action version
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
joeyahines e2eceeb13a add basic rust ci using task
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
joeyahines 05e773d62c add taskfile and cleanup project 2026-03-15 18:46:13 -06:00
joeyahines 3ef95614f0 Bump versions, fix clippy errors 2026-03-01 17:31:31 -07:00
11 changed files with 209 additions and 96 deletions

No files matched your search

+29
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
+24
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: https://gitea.com/actions/gitea-release-action@v1
with:
files: |-
target/release/formaty
-31
View File
@@ -1,31 +0,0 @@
clone:
git:
image: "woodpeckerci/plugin-git:next"
pipeline:
compliance:
commands:
- "rustup component add clippy"
- "cargo build --verbose"
- "cargo clippy --workspace --tests --all-targets --all-features"
- "cargo test --workspace --no-fail-fast"
image: "rust:1.77-buster"
when:
event: pull_request, push
build:
commands:
- "cargo build --release"
image: "rust:1.77-buster"
when:
branch: main
event: push
release:
image: jolheiser/drone-gitea-main:latest
settings:
token:
from_secret: gitea_token
base: https://git.jojodev.com
files:
- "target/release/formaty"
when:
branch: main
event: push
Generated
+74 -42
View File
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "aho-corasick"
@@ -159,7 +159,7 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "formaty"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"bitvec",
"byteorder",
@@ -170,7 +170,7 @@ dependencies = [
"rust-embed",
"serde",
"structopt",
"thiserror",
"thiserror 2.0.18",
"toml",
]
@@ -216,9 +216,9 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.14.5"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
[[package]]
name = "heck"
@@ -246,9 +246,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "indexmap"
version = "2.2.6"
version = "2.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
dependencies = [
"equivalent",
"hashbrown",
@@ -343,9 +343,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.81"
version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba"
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
dependencies = [
"unicode-ident",
]
@@ -382,7 +382,7 @@ checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
dependencies = [
"getrandom",
"redox_syscall",
"thiserror",
"thiserror 1.0.63",
]
[[package]]
@@ -434,7 +434,7 @@ dependencies = [
"proc-macro2",
"quote",
"rust-embed-utils",
"syn 2.0.60",
"syn 2.0.117",
"walkdir",
]
@@ -460,31 +460,41 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.199"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a"
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
name = "serde_core"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.199"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc"
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.117",
]
[[package]]
name = "serde_spanned"
version = "0.6.5"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1"
checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776"
dependencies = [
"serde",
"serde_core",
]
[[package]]
@@ -541,9 +551,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.60"
version = "2.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3"
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
dependencies = [
"proc-macro2",
"quote",
@@ -571,7 +581,16 @@ version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
dependencies = [
"thiserror-impl",
"thiserror-impl 1.0.63",
]
[[package]]
name = "thiserror"
version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
dependencies = [
"thiserror-impl 2.0.18",
]
[[package]]
@@ -582,43 +601,59 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.117",
]
[[package]]
name = "thiserror-impl"
version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.117",
]
[[package]]
name = "toml"
version = "0.8.12"
version = "1.0.3+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3"
checksum = "c7614eaf19ad818347db24addfa201729cf2a9b6fdfd9eb0ab870fcacc606c0c"
dependencies = [
"serde",
"indexmap",
"serde_core",
"serde_spanned",
"toml_datetime",
"toml_edit",
"toml_parser",
"toml_writer",
"winnow",
]
[[package]]
name = "toml_datetime"
version = "0.6.5"
version = "1.0.0+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e"
dependencies = [
"serde",
"serde_core",
]
[[package]]
name = "toml_edit"
version = "0.22.12"
name = "toml_parser"
version = "1.0.9+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef"
checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "toml_writer"
version = "1.0.6+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607"
[[package]]
name = "typenum"
version = "1.15.0"
@@ -711,12 +746,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "winnow"
version = "0.6.7"
version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578"
dependencies = [
"memchr",
]
checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"
[[package]]
name = "wyz"
+4 -4
View File
@@ -1,20 +1,20 @@
[package]
name = "formaty"
version = "0.3.0"
edition = "2021"
version = "0.4.0"
edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
structopt = "0.3.23"
serde = { version = "1.0", features = ["derive"] }
toml = "0.8.12"
toml = "1.0.3"
byteorder = "1.5.0"
num-bigint = "0.4.4"
bitvec = "1.0.1"
platform-dirs = "0.3.0"
hex = "0.4.3"
thiserror = "1.0.63"
thiserror = "2.0.18"
regex = "1.10.6"
[dependencies.rust-embed]
+39
View File
@@ -0,0 +1,39 @@
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: '3'
tasks:
version:
desc: Print out Rust version info
cmds:
- cargo --version
- rustc --version
- cargo clippy --version
build:
desc: Debug build
cmds:
- cargo build --timings --tests --bins
test:
desc: Test code
deps: [build]
cmds:
- cargo test --locked
build:release:
desc: Release build
cmds:
- cargo build --release --locked --timings
fmt:
desc: Format Rust code
cmds:
- cargo fmt
check:
desc: Lint code with Clippy
cmds:
- cargo check
- cargo fmt --check
- cargo clippy
clean:
desc: Purge Rust build cache
cmds:
- cargo clean
+19 -1
View File
@@ -54,7 +54,7 @@ impl ByteStream {
let mut data: Vec<u8> = vec![];
if bit_count % 8 != 0 {
if !bit_count.is_multiple_of(8) {
let bits_needed = bit_count % 8;
data.push(bits[bit_ndx..bit_ndx + bits_needed].load::<u8>());
bit_ndx += bits_needed;
@@ -148,4 +148,22 @@ mod tests {
let new_bytes = bit_stream.get_bytes::<BigEndian>(0, 3).unwrap();
assert_eq!(vec![0x02], new_bytes);
}
#[test]
fn test_get_bytes_9_bits() {
let bytes: Vec<u8> = vec![0xff, 0x80];
let bit_stream = ByteStream::from(bytes.clone());
let new_bytes = bit_stream.get_bytes::<BigEndian>(0, 9).unwrap();
assert_eq!(vec![0x01, 0xff], new_bytes);
}
#[test]
fn test_get_bytes_9_bits_mid_byte() {
let bytes: Vec<u8> = vec![0x0f, 0xf8];
let bit_stream = ByteStream::from(bytes.clone());
let new_bytes = bit_stream.get_bytes::<BigEndian>(4, 9).unwrap();
assert_eq!(vec![0x01, 0xff], new_bytes);
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
use crate::formatter::format::FormatError;
use crate::formatter::FormatConfigError;
use crate::formatter::format::FormatError;
use crate::parser::ByteArrayParseErr;
use std::error::Error;
use std::fmt::{Display, Formatter};
+7 -5
View File
@@ -2,7 +2,7 @@ use std::fmt::Write;
use std::io::Cursor;
use std::string::FromUtf8Error;
use crate::byte_stream::{bit_mask, ByteStream, ByteStreamError};
use crate::byte_stream::{ByteStream, ByteStreamError, bit_mask};
use crate::formatter::bytes_operations::ByteOrderOperations;
use crate::formatter::format_config::FormatConfig;
use crate::formatter::printers::PrintType;
@@ -351,10 +351,10 @@ impl Format {
#[cfg(test)]
mod tests {
use crate::Format;
use crate::byte_stream::ByteStream;
use crate::formatter::format::{Endianness, Field, FieldType};
use crate::formatter::format_config::FormatConfig;
use crate::Format;
#[test]
fn test_format_int_4_bits() {
@@ -504,9 +504,11 @@ mod tests {
let mut byte_stream = ByteStream::from(b"\x3D\x70\xA3\xD7".to_vec());
assert!(field
.format_data(&mut byte_stream, 0, &FormatConfig::default())
.is_err())
assert!(
field
.format_data(&mut byte_stream, 0, &FormatConfig::default())
.is_err()
)
}
#[test]
+11 -11
View File
@@ -1,13 +1,13 @@
use crate::deframer::Deframer;
use crate::formatter::format::{Format, FormatError};
use crate::formatter::FormatConfigError;
use crate::formatter::format::{Format, FormatError};
use platform_dirs::AppDirs;
use rust_embed::RustEmbed;
use serde::Deserialize;
use std::fs::{read_dir, File};
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)
}
+1 -1
View File
@@ -12,7 +12,7 @@ use thiserror::Error;
pub enum FormatConfigError {
#[error("IO error")]
IOError(#[from] std::io::Error),
#[error("TOML Format Error")]
#[error("TOML Format Error in '{file_name}': {err}")]
TomlError {
file_name: String,
err: toml::de::Error,