Browse Source

Consolidate gha-more-disk-space.sh script (#8967)

Trask Stalnaker 1 year ago
parent
commit
8f6b00b6b1

+ 9 - 0
.github/scripts/gha-free-disk-space.sh

@@ -0,0 +1,9 @@
+#!/bin/bash -e
+
+# GitHub Actions runners have only provide 14 GB of disk space which we have been exceeding regularly
+# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
+
+df -h
+sudo rm -rf /usr/local/lib/android
+sudo rm -rf /usr/share/dotnet
+df -h

+ 9 - 25
.github/workflows/build-common.yml

@@ -27,16 +27,11 @@ jobs:
   spotless:
     runs-on: ubuntu-latest
     steps:
-      # spotless may fail without freeing up more disk space on the runner
-      - name: Free disk space
-        run: |
-          df -h
-          sudo rm -rf /usr/local/lib/android
-          sudo rm -rf /usr/share/dotnet
-          df -h
-
       - uses: actions/checkout@v3
 
+      - name: Free disk space
+        run: .github/scripts/gha-free-disk-space.sh
+
       - name: Set up JDK for running Gradle
         uses: actions/setup-java@v3
         with:
@@ -170,16 +165,11 @@ jobs:
             vm: openj9
       fail-fast: false
     steps:
-      # tests may fail without freeing up more disk space on the runner
-      - name: Free disk space
-        run: |
-          df -h
-          sudo rm -rf /usr/local/lib/android
-          sudo rm -rf /usr/share/dotnet
-          df -h
-
       - uses: actions/checkout@v3
 
+      - name: Free disk space
+        run: .github/scripts/gha-free-disk-space.sh
+
       - id: setup-test-java
         name: Set up JDK ${{ matrix.test-java-version }}-${{ matrix.vm }} for running tests
         uses: actions/setup-java@v3
@@ -301,17 +291,11 @@ jobs:
         run: git config --system core.longpaths true
         if: matrix.os == 'windows-latest'
 
-      # downloading the liberty image (a bit over 10gb) fails without freeing up more disk space on the runner
-      - name: Free disk space
-        run: |
-          df -h
-          sudo rm -rf /usr/local/lib/android
-          sudo rm -rf /usr/share/dotnet
-          df -h
-        if: matrix.os == 'ubuntu-latest'
-
       - uses: actions/checkout@v3
 
+      - name: Free disk space
+        run: .github/scripts/gha-free-disk-space.sh
+
       - name: Set up JDK for running Gradle
         uses: actions/setup-java@v3
         with:

+ 3 - 8
.github/workflows/codeql-daily.yml

@@ -11,16 +11,11 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-      # analysis may fail without freeing up more disk space on the runner
-      - name: Free disk space
-        run: |
-          df -h
-          sudo rm -rf /usr/local/lib/android
-          sudo rm -rf /usr/share/dotnet
-          df -h
-
       - uses: actions/checkout@v3
 
+      - name: Free disk space
+        run: .github/scripts/gha-free-disk-space.sh
+
       - name: Set up Java 17
         uses: actions/setup-java@v3
         with:

+ 3 - 0
.github/workflows/reusable-smoke-test-images.yml

@@ -28,6 +28,9 @@ jobs:
     steps:
       - uses: actions/checkout@v3
 
+      - name: Free disk space
+        run: .github/scripts/gha-free-disk-space.sh
+
       - name: Set up JDK for running Gradle
         uses: actions/setup-java@v3
         with:

+ 3 - 8
.github/workflows/reusable-test-latest-deps.yml

@@ -30,16 +30,11 @@ jobs:
           - 3
       fail-fast: false
     steps:
-      # tests may fail without freeing up more disk space on the runner
-      - name: Free disk space
-        run: |
-          df -h
-          sudo rm -rf /usr/local/lib/android
-          sudo rm -rf /usr/share/dotnet
-          df -h
-
       - uses: actions/checkout@v3
 
+      - name: Free disk space
+        run: .github/scripts/gha-free-disk-space.sh
+
       - name: Set up JDK for running Gradle
         uses: actions/setup-java@v3
         with: