1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct PipelineReport {
6 pub version: String,
7 pub project: String,
8 pub pipeline: String,
9 pub context: ContextReport,
10 pub started_at: DateTime<Utc>,
11 pub completed_at: Option<DateTime<Utc>>,
12 pub duration_ms: Option<u64>,
13 pub status: PipelineStatus,
14 pub tasks: Vec<TaskReport>,
15}
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
18pub struct ContextReport {
19 pub provider: String,
20 pub event: String,
21 pub ref_name: String,
22 pub base_ref: Option<String>,
23 pub sha: String,
24 pub changed_files: Vec<String>,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct TaskReport {
29 pub name: String,
30 pub status: TaskStatus,
31 pub duration_ms: u64,
32 pub exit_code: Option<i32>,
33 pub inputs_matched: Vec<String>,
34 pub cache_key: Option<String>,
35 pub outputs: Vec<String>,
36}
37
38#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
39#[serde(rename_all = "lowercase")]
40pub enum TaskStatus {
41 Success,
42 Failed,
43 Cached,
44 Skipped,
45}
46
47#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
48#[serde(rename_all = "lowercase")]
49pub enum PipelineStatus {
50 Pending,
51 Success,
52 Failed,
53 Partial,
54}
55
56#[derive(Debug, Clone)]
58pub struct CheckHandle {
59 pub id: String,
60}
61
62pub mod json;
63pub mod markdown;