Skip to content

Commit

Permalink
Use GitHub runner temp dir when available
Browse files Browse the repository at this point in the history
  • Loading branch information
mars committed Oct 23, 2024
1 parent 8c99f74 commit 07e7abe
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions buildpacks/release-phase/tests/integration_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Required due to: https://github.com/rust-lang/rust/issues/95513
#![allow(unused_crate_dependencies)]

use std::{env, path::Path};

use libcnb_test::{assert_contains, ContainerConfig};
use tempfile::tempdir;
use test_support::{
Expand Down Expand Up @@ -67,8 +69,15 @@ fn project_uses_release_build_and_web_process_loads_artifacts() {
"./fixtures/project_uses_release_build_with_web_process",
|ctx| {
let unique = Uuid::new_v4();
let local_storage_path =
let maybe_github_runner_temp_dir = env::var("RUNNER_TEMP");
let temp_dir =
tempdir().expect("should create temporary directory for artifact storage");
let local_storage_path =
if let Ok(github_runner_temp_dir) = &maybe_github_runner_temp_dir {
Path::new(github_runner_temp_dir)
} else {
temp_dir.path()
};
let container_volume_path = "/static-artifacts-storage";
let container_volume_url = "file://".to_owned() + container_volume_path;

Expand All @@ -80,7 +89,7 @@ fn project_uses_release_build_and_web_process_loads_artifacts() {
ContainerConfig::new()
.env("RELEASE_ID", unique)
.env("STATIC_ARTIFACTS_URL", &container_volume_url)
.bind_mount(local_storage_path.path(), container_volume_path),
.bind_mount(local_storage_path, container_volume_path),
&"release".to_string(),
|container| {
let log_output = container.logs_now();
Expand All @@ -99,7 +108,7 @@ fn project_uses_release_build_and_web_process_loads_artifacts() {
ContainerConfig::new()
.env("RELEASE_ID", unique)
.env("STATIC_ARTIFACTS_URL", &container_volume_url)
.bind_mount(local_storage_path.path(), container_volume_path),
.bind_mount(local_storage_path, container_volume_path),
&"web".to_string(),
|container| {
let log_output = container.logs_now();
Expand Down

0 comments on commit 07e7abe

Please sign in to comment.