Upload native-image argfiles (#9094)

In PR #8953, in commit ba0a69de6e, I have introduced argument files to the `native-image`. In this PR, let's try to upload these argfiles as artifacts on GH, so that we can inspect them later.
This commit is contained in:
Pavel Marek 2024-02-26 20:25:37 +01:00 committed by GitHub
parent a7251eb8d4
commit f48caac586
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 46 additions and 3 deletions

View File

@ -1,5 +1,5 @@
# This file is used to generate `target/<profile>/build/enso-build-<hash>/out/paths.rs`.
# Generation logic is in `ci_utils/src/paths.rs`.
# Generation logic is in `build/macros/lib/src/paths.rs`.
<repo_root>/:
.github/:
@ -89,8 +89,13 @@
test/:
resources/:
Factorial.enso:
target/:
native-image-args.txt:
runtime/:
target/:
launcher/:
target/:
native-image-args.txt:
runtime-benchmarks/:
bench-report.xml:
lib/:
@ -98,6 +103,10 @@
parser/:
generate-java/:
java/:
scala/:
project-manager/:
target/:
native-image-args.txt:
target/:
ensogl-pack/:
dist/: # Here ensogl-pack outputs its artifacts

View File

@ -216,6 +216,35 @@ impl RunContext {
Ok(())
}
/// During the native-image build, the engine generates arg files. This function uploads them as
/// artifacts on the CI, so we can inspect them later.
/// Note that if something goes wrong, the native image arg files may not be present.
async fn upload_native_image_arg_files(&self) -> Result {
debug!("Uploading Native Image Arg Files");
let engine_runner_ni_argfile =
&self.repo_root.engine.runner.target.native_image_args_txt.path;
let launcher_ni_argfile = &self.repo_root.engine.launcher.target.native_image_args_txt.path;
let project_manager_ni_argfile =
&self.repo_root.lib.scala.project_manager.target.native_image_args_txt.path;
let native_image_arg_files = [
(engine_runner_ni_argfile, "Engine Runner native-image-args"),
(launcher_ni_argfile, "Launcher native-image-args"),
(project_manager_ni_argfile, "Project Manager native-image-args"),
];
for (argfile, artifact_name) in native_image_arg_files {
if argfile.exists() {
ide_ci::actions::artifacts::upload_single_file(&argfile, artifact_name).await?;
} else {
warn!(
"Native Image Arg File for {} not found at {}",
artifact_name,
argfile.display()
);
}
}
Ok(())
}
pub async fn build(&self) -> Result<BuiltArtifacts> {
self.prepare_build_env().await?;
if ide_ci::ci::run_in_ci() {
@ -475,6 +504,8 @@ impl RunContext {
// If we were running any benchmarks, they are complete by now. Upload the report.
if is_in_env() {
self.upload_native_image_arg_files().await?;
for bench in &self.config.execute_benchmarks {
match bench {
Benchmarks::Runtime => {

View File

@ -162,6 +162,9 @@ public class HttpDownloaderTest {
task.addProgressListener(progressListener);
var resp = task.force();
assertThat(resp.content(), containsString("Hello"));
assertThat("Done was called exactly once", doneCalls[0], is(1));
assertThat(
"Progress reported was called at least once", progressUpdateCalls[0], greaterThan(0));
}
private static class TextHandler extends SimpleHttpHandler {
@ -188,9 +191,9 @@ public class HttpDownloaderTest {
}
private static class BigFileHandler extends SimpleHttpHandler {
private static final long BIG_FILE_SIZE = 10 * 1024;
private static final byte[] BIG_FILE_BYTES = new byte[Math.toIntExact(BIG_FILE_SIZE)];
private static final int CHUNK_SIZE = 1024;
private static final long BIG_FILE_SIZE = 10 * CHUNK_SIZE;
private static final byte[] BIG_FILE_BYTES = new byte[Math.toIntExact(BIG_FILE_SIZE)];
static {
var rnd = new Random(42);