Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
gnalh committed Dec 18, 2024
1 parent eeb0e66 commit fd55edf
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
3 changes: 0 additions & 3 deletions .github/actions/setup_rust_cargo/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ runs:
sudo /usr/bin/apt install -y protobuf-compiler
fi
- name: Install cmake
uses: ./.github/actions/setup_proto

- uses: actions/cache@v4
with:
path: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ jobs:
- name: Setup Ruby
uses: ./.github/actions/setup_ruby

- name: Setup proto
uses: ./.github/actions/setup_proto

- name: Build workspace
run: cargo build --all

Expand Down
5 changes: 3 additions & 2 deletions cli/src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,9 @@ pub async fn run_upload(
}
}

let bundle_temp_dir = tempfile::tempdir()?;
let bundle_time_file = bundle_temp_dir.path().join("bundle.tar.zstd");
let bundle_temp_dir = std::path::Path::new("/tmp");
let bundle_time_file = bundle_temp_dir.join("bundle.tar.zstd");
println!("Creating bundle tarball... {}", bundle_time_file.display());
let bundle = BundlerUtil::new(meta, bep_result);
bundle.make_tarball(&bundle_time_file)?;
log::info!("Flushed temporary tarball to {:?}", bundle_time_file);
Expand Down
4 changes: 2 additions & 2 deletions context-py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ fn junit_parse(xml: Vec<u8>) -> PyResult<Vec<junit::bindings::BindingsReport>> {
#[gen_stub_pyfunction]
#[pyfunction]
fn bin_parse(bin: Vec<u8>) -> PyResult<Vec<junit::bindings::BindingsReport>> {
let test_cases = proto::test_context::test_run::TestResult::decode(&*bin).unwrap();
let bindings_report = junit::bindings::BindingsReport::from(test_cases);
let test_result = proto::test_context::test_run::TestResult::decode(&*bin).unwrap();
let bindings_report = junit::bindings::BindingsReport::from(test_result);
Ok(vec![bindings_report])
}

Expand Down
2 changes: 2 additions & 0 deletions context-ruby/ext/context_ruby/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 context-ruby/spec/trunk_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def description_generated?(example)

def generate_id(example)
"#{example.id}-#{example.location}" if description_generated?(example)
''
nil
end

# trunk-ignore(rubocop/Metrics/AbcSize,rubocop/Metrics/MethodLength)
Expand Down
8 changes: 4 additions & 4 deletions context/src/junit/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ pub fn validate(report: &Report) -> JunitReportValidation {
if let Some(raw_test_case_id) = test_case.extra.get("id") {
let test_case_id = uuid::Uuid::parse_str(raw_test_case_id).unwrap_or_default();
if test_case_id.get_version() != Some(uuid::Version::Sha1) {
test_case_validation.add_issue(JunitValidationIssue::Invalid(
JunitTestCaseValidationIssueInvalid::TestCaseInvalidId(
test_case_validation.add_issue(JunitValidationIssue::SubOptimal(
JunitTestCaseValidationIssueSubOptimal::TestCaseInvalidId(
raw_test_case_id.to_string().clone(),
),
));
Expand Down Expand Up @@ -607,12 +607,12 @@ pub enum JunitTestCaseValidationIssueSubOptimal {
TIMESTAMP_STALE_HOURS
)]
TestCaseStaleTimestamp(DateTime<FixedOffset>),
#[error("test case id is not a valid uuidv5")]
TestCaseInvalidId(String),
}

#[derive(Error, Debug, Clone, PartialEq, Eq)]
pub enum JunitTestCaseValidationIssueInvalid {
#[error("test case name too short")]
TestCaseNameTooShort(String),
#[error("test case id is not a valid uuidv5")]
TestCaseInvalidId(String),
}
16 changes: 6 additions & 10 deletions test_report/src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,19 @@ impl MutTestReport {

// sends out to the trunk api
pub fn publish(&self) -> bool {
self.0
.borrow_mut()
.test_result
.uploader_metadata
.as_mut()
.unwrap()
.upload_time = Some(Timestamp {
seconds: Utc::now().timestamp(),
nanos: Utc::now().timestamp_subsec_nanos() as i32,
});
let path = self.save();
let token = std::env::var("TRUNK_API_TOKEN").unwrap_or_default();
let org_url_slug = std::env::var("TRUNK_ORG_URL_SLUG").unwrap_or_default();
if token.is_empty() || org_url_slug.is_empty() {
println!("Missing TRUNK_API_TOKEN or TRUNK_ORG_URL_SLUG");
return false;
}
if let Some(uploader_metadata) = &mut self.0.borrow_mut().test_result.uploader_metadata {
uploader_metadata.upload_time = Some(Timestamp {
seconds: Utc::now().timestamp(),
nanos: Utc::now().timestamp_subsec_nanos() as i32,
});
}
let upload_args = trunk_analytics_cli::upload::UploadArgs::new(
token,
org_url_slug,
Expand Down

0 comments on commit fd55edf

Please sign in to comment.