summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2024-01-10 18:00:51 +0200
committerLars Wirzenius <liw@liw.fi>2024-01-10 18:00:51 +0200
commit6627cd29e0e3fd789743e0bfa713e2fbf175bdc9 (patch)
treebfd2939e1fc5ee2bd23db0f06221fe1c39ef6e5a
parent87f91e2474a36910228430bd4d5ce8700d86eab4 (diff)
downloadradicle-native-ci-6627cd29e0e3fd789743e0bfa713e2fbf175bdc9.tar.gz
fix: undo rename of run info field id
Signed-off-by: Lars Wirzenius <liw@liw.fi>
-rw-r--r--Cargo.toml1
-rw-r--r--src/bin/run_info.rs14
-rw-r--r--src/report.rs2
-rw-r--r--src/runinfo.rs4
4 files changed, 18 insertions, 3 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 1ce3786..a6a1001 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,6 +2,7 @@
name = "radicle-native-ci"
version = "0.1.0"
edition = "2021"
+default-run = "radicle-native-ci"
[dependencies]
html-page = "0.1.0"
diff --git a/src/bin/run_info.rs b/src/bin/run_info.rs
new file mode 100644
index 0000000..c16120b
--- /dev/null
+++ b/src/bin/run_info.rs
@@ -0,0 +1,14 @@
+use std::path::Path;
+
+use radicle_native_ci::{report::ReportError, runinfo::RunInfo};
+
+/// The main program.
+fn main() {
+ let x = read_file_info(Path::new("run.yaml")).expect("parse yaml");
+ println!("{:#?}", x);
+}
+
+fn read_file_info(filename: &Path) -> Result<RunInfo, ReportError> {
+ let yaml = std::fs::read(filename).map_err(|e| ReportError::ReadRunInfo(filename.into(), e))?;
+ serde_yaml::from_slice(&yaml).map_err(|e| ReportError::DeserializeRunInfo(filename.into(), e))
+}
diff --git a/src/report.rs b/src/report.rs
index b027133..5ab7d4c 100644
--- a/src/report.rs
+++ b/src/report.rs
@@ -76,7 +76,7 @@ fn list_runs(repos: &[&str], run_infos: &[RunInfo]) -> Document {
let run_id = Element::new(Tag::Code)
.with_class("run_id")
- .with_text(&ri.run_id);
+ .with_text(&ri.id);
let timestamp = Element::new(Tag::Span)
.with_class("timestamp")
diff --git a/src/runinfo.rs b/src/runinfo.rs
index 0e09dee..9d83227 100644
--- a/src/runinfo.rs
+++ b/src/runinfo.rs
@@ -18,7 +18,7 @@ pub struct RunInfo {
pub commit: String,
/// Identifier for the CI run.
- pub run_id: String,
+ pub id: String,
/// Result of the CI run.
pub result: RunResult,
@@ -96,7 +96,7 @@ impl RunInfoBuilder {
Ok(RunInfo {
repo: self.repo.map(|x| x.to_string()).unwrap_or("".into()),
commit: self.commit.map(|x| x.to_string()).unwrap_or("".into()),
- run_id: self.run_id.unwrap_or("<unknown>".into()),
+ id: self.run_id.unwrap_or("<unknown>".into()),
result: self
.result
.ok_or(RunInfoError::MissingInfo("result".into()))?,