Skip to content

Commit 1935ecf

Browse files
authored
CI: fix flaky e2e tests with more disk space (#3628)
* CI: e2e tests, use latest telemetry for disk usage * CI: avoid overwriting demo logs on retries - Write stderr to same file as stdout * CI: make more space on github runners It's not clear if this will help, but it might. * show available disk space
1 parent c9d0aa2 commit 1935ecf

File tree

2 files changed

+55
-5
lines changed

2 files changed

+55
-5
lines changed

.github/workflows/test.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,32 @@ jobs:
328328
fail-fast: false
329329
runs-on: ubuntu-latest
330330
steps:
331+
332+
# The demo l1 (geth) sometimes shuts down due to perceived low disk space.
333+
- uses: cargo-bins/cargo-binstall@main
334+
- name: Make more disk space available on public runner
335+
run: |
336+
# rmz seems to be faster at deleting files than rm
337+
cargo binstall -y --version 2.2.0 rmz
338+
sudo mv /home/runner/.cargo/bin/rmz /usr/local/bin/rmz
339+
340+
echo "Available storage before:"
341+
sudo df -h
342+
echo
343+
sudo rmz -f /usr/share/dotnet
344+
sudo rmz -f /usr/share/swift
345+
sudo rmz -f /usr/share/gradle-*
346+
sudo rmz -f /usr/share/az_*
347+
sudo rmz -f /usr/local/lib/android
348+
sudo rmz -f /opt/ghc
349+
sudo rmz -f /opt/az
350+
sudo rmz -f /opt/pipx
351+
sudo rmz -f /opt/google
352+
sudo rmz -f /opt/microsoft
353+
echo "Available storage after:"
354+
sudo df -h
355+
echo
356+
331357
- name: Install Nix
332358
uses: cachix/install-nix-action@v31
333359

@@ -354,7 +380,7 @@ jobs:
354380
run: nix profile install nixpkgs/3730d8a308f94996a9ba7c7138ede69c1b9ac4ae#process-compose
355381

356382
- name: Collect Workflow Telemetry
357-
uses: catchpoint/workflow-telemetry-action@v2
383+
uses: catchpoint/workflow-telemetry-action@master
358384
with:
359385
comment_on_pr: false
360386

@@ -371,6 +397,12 @@ jobs:
371397
run: |
372398
tail -n 1000 ${{ env.NATIVE_DEMO_LOGS }}
373399
400+
# for debugging: geth may shut down if it detects low disk space
401+
- name: Show available disk space
402+
if: always()
403+
run: |
404+
df -h
405+
374406
- name: Upload process compose logs
375407
if: always()
376408
uses: actions/upload-artifact@v4

tests/common/mod.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::{
22
fmt,
3-
fs::File,
4-
io::{stderr, stdout},
3+
io::{stderr, stdout, Write},
54
path::{Path, PathBuf},
65
process::{Child, Command},
76
str::FromStr,
@@ -352,8 +351,27 @@ impl NativeDemo {
352351
});
353352

354353
println!("Writing native demo logs to file: {log_path}");
355-
let outputs = File::create(log_path).context("unable to create log file")?;
356-
cmd.stdout(outputs);
354+
355+
let is_ci = std::env::var("CI").unwrap_or_default() == "true";
356+
357+
// Open file in append mode if CI, otherwise truncate
358+
let mut log_file = std::fs::OpenOptions::new()
359+
.create(true)
360+
.append(is_ci)
361+
.truncate(!is_ci)
362+
.write(true)
363+
.open(&log_path)
364+
.context("unable to open log file")?;
365+
writeln!(log_file, "==== process-compose logs =====")?;
366+
log_file.flush()?;
367+
368+
// Redirect both stdout and stderr to the same file
369+
cmd.stdout(
370+
log_file
371+
.try_clone()
372+
.context("unable to clone log file for stdout")?,
373+
);
374+
cmd.stderr(log_file);
357375

358376
println!("Spawning: {cmd:?}");
359377
let mut child = cmd.spawn().context("failed to spawn command")?;

0 commit comments

Comments
 (0)