Skip to content

Commit

Permalink
ci: add workaround to prevent "no space left on device" error (#3172)
Browse files Browse the repository at this point in the history
The error had been occurring for a few weeks when running e2e tests for
Chrome on Ubuntu.
Remove some cached tools to free up space as suggested in the official
"runner-images" repository.
  • Loading branch information
tbouffard authored Oct 6, 2024
1 parent 3a32910 commit 0669099
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/actions/free-runner-disk-space-ubuntu/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Free disk space on Ubuntu runner'
description: 'Remove unused cached tools, to free disk space'

runs:
using: composite
steps:
#
# https://github.com/actions/runner-images/issues/2840#issuecomment-2272410832 (2024-08-07), taking implementation done in https://github.com/cilium/cilium/commit/e553bd23443ef14c8cbbeeafa7ebab3bb30c3fac and remove only tools that we don't use
# We may also use https://github.com/jlumbroso/free-disk-space mentioned in https://github.com/actions/runner-images/issues/2875#issuecomment-1163363045
- name: Free up disk space
shell: bash
run: |
echo "Disk space before cleanup..."
df -kh
echo "Removing unnecessary files to free up disk space..."
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
echo "Disk space after cleanup..."
df -kh
16 changes: 16 additions & 0 deletions .github/actions/log-disk-space/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Log disk space'
description: 'Log disk space (for troubleshooting)'

runs:
using: "composite"

steps:
- name: Log disk space on Unix based OS
shell: bash
if: runner.os != 'Windows'
run: df -kh
- name: Log disk space on Windows
shell: pwsh
if: runner.os == 'Windows'
run: Get-Volume

8 changes: 8 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,25 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free disk space on Ubuntu runner
if: runner.os == 'Linux'
uses: ./.github/actions/free-runner-disk-space-ubuntu
- name: Build Setup
uses: ./.github/actions/build-setup
- name: Install ${{matrix.browser}}
uses: ./.github/actions/install-playwright-browser
with:
browser: ${{matrix.browser}}
- name: Log disk space
uses: ./.github/actions/log-disk-space
- name: Test Application End to End
id: 'test_e2e'
env:
BROWSERS: ${{matrix.browser}}
run: npm run test:e2e:verbose
- name: Log disk space
uses: ./.github/actions/log-disk-space
if: always()
- name: Upload e2e test results
if: ${{ failure() && steps.test_e2e.outcome == 'failure' }}
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 0669099

Please sign in to comment.