Skip to content

Commit

Permalink
Upload native-image argfiles (#9094)
Browse files Browse the repository at this point in the history
In PR #8953, in commit ba0a69d, 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.
  • Loading branch information
Akirathan authored Feb 26, 2024
1 parent a7251eb commit f48caac
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
11 changes: 10 additions & 1 deletion build/build/paths.yaml
Original file line number Diff line number Diff line change
@@ -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/:
Expand Down Expand Up @@ -89,15 +89,24 @@
test/:
resources/:
Factorial.enso:
target/:
native-image-args.txt:
runtime/:
target/:
launcher/:
target/:
native-image-args.txt:
runtime-benchmarks/:
bench-report.xml:
lib/:
rust/:
parser/:
generate-java/:
java/:
scala/:
project-manager/:
target/:
native-image-args.txt:
target/:
ensogl-pack/:
dist/: # Here ensogl-pack outputs its artifacts
Expand Down
31 changes: 31 additions & 0 deletions build/build/src/engine/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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 => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ public void done(Try<APIResponse> result) {
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 {
Expand All @@ -188,9 +191,9 @@ protected void doHandle(HttpExchange exchange) throws IOException {
}

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);
Expand Down

0 comments on commit f48caac

Please sign in to comment.