Skip to content

Commit

Permalink
fix: publish may be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
loispostula committed Mar 5, 2024
1 parent bb9f82b commit b7d521d
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fslabscli"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
authors = ["FSLABS DevOps Gods"]
repository = "https://github.com/ForesightMiningSoftwareCorporation/fslabsci"
Expand Down
20 changes: 13 additions & 7 deletions src/commands/check_workspace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ pub struct PackageMetadataFslabsCiTest {
pub skip: Option<bool>,
}

#[derive(Deserialize, Default)]
#[derive(Deserialize, Default, Debug)]
struct PackageMetadataFslabsCi {
pub publish: PackageMetadataFslabsCiPublish,
pub publish: Option<PackageMetadataFslabsCiPublish>,
#[serde(default)]
pub test: PackageMetadataFslabsCiTest,
pub test: Option<PackageMetadataFslabsCiTest>,
}

#[derive(Deserialize, Default)]
#[derive(Deserialize, Default, Debug)]
struct PackageMetadata {
pub fslabs: PackageMetadataFslabsCi,
}
Expand All @@ -146,8 +146,11 @@ impl Result {
.unwrap()
.to_path_buf();
let metadata: PackageMetadata =
from_value(package.metadata).unwrap_or_else(|_| PackageMetadata::default());
let mut publish = metadata.fslabs.publish;
from_value(package.metadata.clone()).unwrap_or_else(|_| PackageMetadata::default());
let mut publish = metadata
.fslabs
.publish
.unwrap_or_else(|| PackageMetadataFslabsCiPublish::default());
publish.cargo.registry = match package.publish.clone() {
Some(r) => Some(r.clone()),
None => {
Expand Down Expand Up @@ -188,7 +191,10 @@ impl Result {
version: package.version.to_string(),
path,
publish_detail: publish,
test_detail: metadata.fslabs.test,
test_detail: metadata
.fslabs
.test
.unwrap_or_else(|| PackageMetadataFslabsCiTest::default()),
dependencies,
..Default::default()
})
Expand Down
2 changes: 1 addition & 1 deletion src/commands/generate_workflow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl FromMap for GithubWorkflowJobSecret {
}
}

#[derive(Clone, Default)]
#[derive(Clone, Default, Debug)]
pub struct StringBool(bool);

impl From<StringBool> for Value {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/generate_workflow/test_workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde_yaml::Value;

use crate::commands::generate_workflow::StringBool;

#[derive(Default, Clone)]
#[derive(Default, Clone, Debug)]
pub struct TestWorkflowArgs {
/// Package that needs to be installed before Rust compilation can happens
pub required_packages: Option<String>,
Expand Down
3 changes: 3 additions & 0 deletions src/commands/summaries/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ pub async fn checks_summaries(
),
("tests".to_string(), check_summary.outputs.tests.clone()),
];
println!("Got subchecks: {:?}", sub_checks.clone());
let mut checked_sub_checks: Vec<(String, CheckOutput)> = vec![];
for (subcheck, check) in sub_checks {
if let Some(check) = check {
Expand All @@ -347,6 +348,7 @@ pub async fn checks_summaries(
}
}
}
println!("Got subchecks: {:?}", checked_sub_checks.clone());
// order sub check by number
checked_sub_checks.sort_by_key(|(_, o)| o.number.unwrap());
check_outputs.push(CheckedOutput {
Expand All @@ -369,6 +371,7 @@ pub async fn checks_summaries(
let mut rows: Vec<Vec<SummaryTableCell>> = vec![header_row];
check_outputs.sort_by_key(|c| c.check_name.clone());
for checked in check_outputs.iter() {
println!("Checked:{} {:?}", checked.check_name, checked.sub_checks);
let colspan = lcm_result / (checked.sub_checks.len());
let check_cell_name = format!(
"{} {}",
Expand Down
8 changes: 4 additions & 4 deletions summaries_data/ci_tests-check.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "ci_tests",
"start_time": "1709641211000",
"end_time": "1709641238000",
"start_time": "1709648904000",
"end_time": "1709648914000",
"working_directory": ".",
"type": "check",
"server_url": "https://github.com",
"repository": "ForesightMiningSoftwareCorporation/ci_tests",
"run_id": "8017778855",
"run_attempt": "22",
"run_id": "8157844148",
"run_attempt": "2",
"actor": "loispostula",
"event_name": "pull_request",
"outputs": {
Expand Down
8 changes: 4 additions & 4 deletions summaries_data/ci_tests-miri.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "ci_tests",
"start_time": "1709641317000",
"end_time": "1709641319000",
"start_time": "1709648904000",
"end_time": "1709648905000",
"working_directory": ".",
"type": "miri",
"server_url": "https://github.com",
"repository": "ForesightMiningSoftwareCorporation/ci_tests",
"run_id": "8017778855",
"run_attempt": "22",
"run_id": "8157844148",
"run_attempt": "2",
"actor": "loispostula",
"event_name": "pull_request",
"outputs": {
Expand Down
8 changes: 4 additions & 4 deletions summaries_data/ci_tests-test.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "ci_tests",
"start_time": "1709641250000",
"end_time": "1709641256000",
"start_time": "1709648903000",
"end_time": "1709648905000",
"working_directory": ".",
"type": "test",
"server_url": "https://github.com",
"repository": "ForesightMiningSoftwareCorporation/ci_tests",
"run_id": "8017778855",
"run_attempt": "22",
"run_id": "8157844148",
"run_attempt": "2",
"actor": "loispostula",
"event_name": "pull_request",
"outputs": {
Expand Down

0 comments on commit b7d521d

Please sign in to comment.