Skip to content

Introduce free-disk-space action to prevent CI build failures#5029

Merged
pwojcikdev merged 1 commit intonanocurrency:developfrom
pwojcikdev:github-ci-free-disk-space
Feb 13, 2026
Merged

Introduce free-disk-space action to prevent CI build failures#5029
pwojcikdev merged 1 commit intonanocurrency:developfrom
pwojcikdev:github-ci-free-disk-space

Conversation

@pwojcikdev
Copy link
Copy Markdown
Contributor

No description provided.

@gr0vity-dev-bot
Copy link
Copy Markdown

gr0vity-dev-bot commented Feb 12, 2026

Test Results for Commit cdbab0f

Pull Request 5029: Results
Overall Status:

Test Case Results

  • 5n4pr_conf_10k_bintree: PASS (Duration: 130s)
  • 5n4pr_conf_10k_change: PASS (Duration: 140s)
  • 5n4pr_conf_change_dependant: PASS (Duration: 160s)
  • 5n4pr_conf_change_independant: PASS (Duration: 167s)
  • 5n4pr_conf_send_dependant: PASS (Duration: 149s)
  • 5n4pr_conf_send_independant: PASS (Duration: 144s)
  • 5n4pr_rocks_10k_bintree: PASS (Duration: 133s)
  • 5n4pr_rocks_10k_change: PASS (Duration: 163s)

Last updated: 2026-02-13 02:06:23 UTC

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a custom GitHub composite action to free disk space on GitHub-hosted Ubuntu runners to prevent CI build failures due to insufficient disk space. The action removes unnecessary pre-installed tools (dotnet, android SDK, GHC, CodeQL), cleans Docker system resources, and clears apt cache.

Changes:

  • Added new composite action .github/actions/free-disk-space/action.yml that performs disk cleanup operations
  • Integrated the action into the docker_test job in unit_tests.yml workflow
  • Integrated the action into the linux_docker_job in build_deploy.yml workflow

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.github/actions/free-disk-space/action.yml New composite action that removes preinstalled tools, prunes Docker system, and cleans apt cache
.github/workflows/unit_tests.yml Added free-disk-space action before Docker test image build
.github/workflows/build_deploy.yml Added free-disk-space action before Docker build in deployment workflow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

shell: bash
run: |
echo "Cleaning Docker system..."
docker system prune -af --volumes
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docker system prune -af --volumes command removes all Docker build cache, which may slow down subsequent Docker builds by preventing layer reuse. This action runs before Docker build steps in both workflows, so cached layers from previous builds that could speed up the current build will be deleted.

Consider either:

  1. Removing the --volumes flag to preserve named volumes
  2. Using a more selective prune command like docker builder prune -af --filter "until=24h" to keep recent cache
  3. Moving this step to run after Docker builds complete, or making it conditional
  4. Adding error handling with || true to make this step best-effort rather than failing the job
Suggested change
docker system prune -af --volumes
docker system prune -af || true

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +35
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
echo "Done removing preinstalled tools"

- name: Clean Docker system
shell: bash
run: |
echo "Cleaning Docker system..."
docker system prune -af --volumes
echo "Done cleaning Docker"

- name: Clean apt cache
shell: bash
run: |
echo "Cleaning apt cache..."
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cleanup steps in this action have no error handling. If any command fails (e.g., a directory doesn't exist or Docker is not available), the entire job will fail. Since freeing disk space is typically a best-effort operation to prevent failures rather than being critical itself, consider adding || true to each command or using set +e to make failures non-fatal.

For example:

sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /usr/local/lib/android || true

This ensures that if one cleanup operation fails, the others can still proceed and the main job continues.

Suggested change
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
echo "Done removing preinstalled tools"
- name: Clean Docker system
shell: bash
run: |
echo "Cleaning Docker system..."
docker system prune -af --volumes
echo "Done cleaning Docker"
- name: Clean apt cache
shell: bash
run: |
echo "Cleaning apt cache..."
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /usr/local/lib/android || true
sudo rm -rf /opt/ghc || true
sudo rm -rf /opt/hostedtoolcache/CodeQL || true
echo "Done removing preinstalled tools"
- name: Clean Docker system
shell: bash
run: |
echo "Cleaning Docker system..."
docker system prune -af --volumes || true
echo "Done cleaning Docker"
- name: Clean apt cache
shell: bash
run: |
echo "Cleaning apt cache..."
sudo apt-get clean || true
sudo rm -rf /var/lib/apt/lists/* || true

Copilot uses AI. Check for mistakes.
@pwojcikdev pwojcikdev merged commit 733f43f into nanocurrency:develop Feb 13, 2026
34 checks passed
@pwojcikdev pwojcikdev deleted the github-ci-free-disk-space branch February 13, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants