summaryrefslogtreecommitdiff
path: root/src/users.rs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-07-03 16:19:48 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-07-03 16:27:23 -0400
commit3e32af6172f6654eb4083552f2b5999594bb95c1 (patch)
treee7e9a67c713ffb92192df178ea5ac9bed579c768 /src/users.rs
parent9b196227dc807aad9069d02a30bb197036328520 (diff)
ci: per user config filesci-users
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'src/users.rs')
-rw-r--r--src/users.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/users.rs b/src/users.rs
new file mode 100644
index 0000000..b7c11bd
--- /dev/null
+++ b/src/users.rs
@@ -0,0 +1,32 @@
+use std::collections::BTreeMap;
+use std::fs::read_to_string;
+use std::path::PathBuf;
+use serde_derive::Deserialize;
+use toml;
+use anyhow;
+
+#[derive(Deserialize)]
+pub struct RcTestGroup {
+ pub max_commits: u64,
+ pub priority: u64,
+ pub tests: Vec<PathBuf>,
+}
+
+#[derive(Deserialize)]
+pub struct RcBranch {
+ pub fetch: String,
+ pub tests: Vec<String>,
+}
+
+#[derive(Deserialize)]
+pub struct Userrc {
+ pub test_group: BTreeMap<String, RcTestGroup>,
+ pub branch: BTreeMap<String, RcBranch>,
+}
+
+pub fn userrc_read(path: &PathBuf) -> anyhow::Result<Userrc> {
+ let config = read_to_string(path)?;
+ let rc: Userrc = toml::from_str(&config)?;
+
+ Ok(rc)
+}