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`. # 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>/: <repo_root>/:
.github/: .github/:
@ -89,8 +89,13 @@
test/: test/:
resources/: resources/:
Factorial.enso: Factorial.enso:
target/:
native-image-args.txt:
runtime/: runtime/:
target/: target/:
launcher/:
target/:
native-image-args.txt:
runtime-benchmarks/: runtime-benchmarks/:
bench-report.xml: bench-report.xml:
lib/: lib/:
@ -98,6 +103,10 @@
parser/: parser/:
generate-java/: generate-java/:
java/: java/:
scala/:
project-manager/:
target/:
native-image-args.txt:
target/: target/:
ensogl-pack/: ensogl-pack/:
dist/: # Here ensogl-pack outputs its artifacts dist/: # Here ensogl-pack outputs its artifacts

View File

@ -216,6 +216,35 @@ impl RunContext {
Ok(()) 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> { pub async fn build(&self) -> Result<BuiltArtifacts> {
self.prepare_build_env().await?; self.prepare_build_env().await?;
if ide_ci::ci::run_in_ci() { 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 we were running any benchmarks, they are complete by now. Upload the report.
if is_in_env() { if is_in_env() {
self.upload_native_image_arg_files().await?;
for bench in &self.config.execute_benchmarks { for bench in &self.config.execute_benchmarks {
match bench { match bench {
Benchmarks::Runtime => { Benchmarks::Runtime => {

View File

@ -162,6 +162,9 @@ public class HttpDownloaderTest {
task.addProgressListener(progressListener); task.addProgressListener(progressListener);
var resp = task.force(); var resp = task.force();
assertThat(resp.content(), containsString("Hello")); 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 { private static class TextHandler extends SimpleHttpHandler {
@ -188,9 +191,9 @@ public class HttpDownloaderTest {
} }
private static class BigFileHandler extends SimpleHttpHandler { 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 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 { static {
var rnd = new Random(42); var rnd = new Random(42);