[ci] Free disk space in Gradle and Bazel builds (#8405)

This commit is contained in:
Tyler Veness
2025-11-29 17:13:29 -08:00
committed by GitHub
parent 473f2a0aff
commit d87e109a4e
3 changed files with 79 additions and 47 deletions

View File

@@ -12,14 +12,14 @@ jobs:
fail-fast: false
matrix:
include:
- { name: "Linux System Core", classifier: "linuxsystemcore", os: ubuntu-24.04, container: "wpilib/systemcore-cross-ubuntu:2027-24.04", action: "build" }
- { name: "Linux System Core Debug", classifier: "linuxsystemcoredebug", os: ubuntu-24.04, container: "wpilib/systemcore-cross-ubuntu:2027-24.04", action: "build" }
- { name: "Linux System Core Static", classifier: "linuxsystemcorestatic", os: ubuntu-24.04, container: "wpilib/systemcore-cross-ubuntu:2027-24.04", action: "build" }
- { name: "Linux System Core Static Debug", classifier: "linuxsystemcorestaticdebug", os: ubuntu-24.04, container: "wpilib/systemcore-cross-ubuntu:2027-24.04", action: "build" }
- { name: "Linux x86-64", classifier: "linuxx86-64,headers,sources", os: ubuntu-24.04, container: "wpilib/systemcore-cross-ubuntu:2027-24.04", action: "test" }
- { name: "Linux x86-64 Debug", classifier: "linuxx86-64debug", os: ubuntu-24.04, container: "wpilib/systemcore-cross-ubuntu:2027-24.04", action: "test" }
- { name: "Linux x86-64 Static", classifier: "linuxx86-64static", os: ubuntu-24.04, container: "wpilib/systemcore-cross-ubuntu:2027-24.04", action: "test" }
- { name: "Linux x86-64 Static Debug", classifier: "linuxx86-64staticdebug", os: ubuntu-24.04, container: "wpilib/systemcore-cross-ubuntu:2027-24.04", action: "test" }
- { name: "Linux System Core", classifier: "linuxsystemcore", os: ubuntu-24.04, action: "build" }
- { name: "Linux System Core Debug", classifier: "linuxsystemcoredebug", os: ubuntu-24.04, action: "build" }
- { name: "Linux System Core Static", classifier: "linuxsystemcorestatic", os: ubuntu-24.04, action: "build" }
- { name: "Linux System Core Static Debug", classifier: "linuxsystemcorestaticdebug", os: ubuntu-24.04, action: "build" }
- { name: "Linux x86-64", classifier: "linuxx86-64,headers,sources", os: ubuntu-24.04, action: "test" }
- { name: "Linux x86-64 Debug", classifier: "linuxx86-64debug", os: ubuntu-24.04, action: "test" }
- { name: "Linux x86-64 Static", classifier: "linuxx86-64static", os: ubuntu-24.04, action: "test" }
- { name: "Linux x86-64 Static Debug", classifier: "linuxx86-64staticdebug", os: ubuntu-24.04, action: "test" }
- { name: "macOS", classifier: "osxuniversal,osxuniversaldebug,headers,sources,osxuniversalstatic,osxuniversalstaticdebug,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug", os: macOS-15, action: "test" }
@@ -34,8 +34,34 @@ jobs:
name: "${{ matrix.action == 'test' && 'Test' || 'Build' }} ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- name: Check disk free space pre-cleanup
run: df -h
- name: Free disk space (Linux)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
if: startsWith(matrix.os, 'ubuntu')
- name: Free disk space (macOS)
# CodeQL: 5G
# go: 748M
# Android: 12G
run: |
rm -rf /Users/runner/hostedtoolcache/CodeQL
rm -rf /Users/runner/hostedtoolcache/go
rm -rf /Users/runner/Library/Android
if: startsWith(matrix.os, 'macOS')
- name: Check disk free space post-cleanup
run: df -h
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
@@ -45,6 +71,10 @@ jobs:
username: ${{ secrets.BAZEL_CACHE_USERNAME }}
password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
- name: Install apt dependencies
if: matrix.os == 'ubuntu-24.04'
run: sudo apt-get install -y libgl1-mesa-dev libx11-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
- if: matrix.os == 'ubuntu-24.04'
uses: bazel-contrib/setup-bazel@0.15.0
with:
@@ -67,15 +97,9 @@ jobs:
fi
shell: bash
- name: Free Space
- name: Check disk free space
if: always()
shell: bash
run: |
if [[ "${{ matrix.os }}" == "windows-2022" ]]; then
fsutil volume diskfree C:
else
df -h /
fi
run: df -h
buildifier:
name: "buildifier"

View File

@@ -35,7 +35,10 @@ jobs:
runs-on: ubuntu-24.04
needs: [validation]
steps:
- name: Free Disk Space
- name: Check disk free space pre-cleanup
run: df -h
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
@@ -45,6 +48,10 @@ jobs:
large-packages: false
docker-images: false
swap-storage: false
- name: Check disk free space post-cleanup
run: df -h
- uses: actions/checkout@v4
with:
fetch-depth: 0
@@ -52,21 +59,24 @@ jobs:
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v2027')
- name: Build with Gradle
# main on 2021-05-30, to include addnab/docker-run-action/pull/17
uses: addnab/docker-run-action@3e77f186b7a929ef010f183a9e24c0f9955ea609
with:
image: ${{ matrix.container }}
options: -v ${{ github.workspace }}:/work -w /work -e ARTIFACTORY_PUBLISH_USERNAME -e ARTIFACTORY_PUBLISH_PASSWORD -e GITHUB_REF -e CI
run: df . && echo $GITHUB_REF && ./gradlew build --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
run: ./gradlew build --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
env:
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Check free disk space
run: df .
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: build/allOutputs
- name: Check disk free space
if: always()
run: df -h
build-host:
env:
MACOSX_DEPLOYMENT_TARGET: 13.3
@@ -113,6 +123,22 @@ jobs:
runs-on: ${{ matrix.os }}
needs: [validation]
steps:
- name: Check disk free space pre-cleanup
run: df -h
- name: Free disk space (macOS)
# CodeQL: 5G
# go: 748M
# Android: 12G
run: |
rm -rf /Users/runner/hostedtoolcache/CodeQL
rm -rf /Users/runner/hostedtoolcache/go
rm -rf /Users/runner/Library/Android
if: startsWith(matrix.os, 'macOS')
- name: Check disk free space post-cleanup
run: df -h
- uses: actions/checkout@v4
with:
fetch-depth: 0
@@ -139,24 +165,6 @@ jobs:
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
shell: bash
if: startsWith(github.ref, 'refs/tags/v2027')
- name: Check disk free space (Windows)
run: wmic logicaldisk get caption, freespace
if: matrix.os == 'windows-2022'
- name: Check disk free space pre-cleanup (macOS)
run: df -h .
if: matrix.os == 'macOS-15'
- name: Cleanup disk space
# CodeQL: 5G
# go: 748M
# Android: 12G
run: |
rm -rf /Users/runner/hostedtoolcache/CodeQL
rm -rf /Users/runner/hostedtoolcache/go
rm -rf /Users/runner/Library/Android
if: matrix.os == 'macOS-15'
- name: Check disk free space post-cleanup (macOS)
run: df -h .
if: matrix.os == 'macOS-15'
- name: Build with Gradle
run: ./gradlew ${{ matrix.task }} --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
env:
@@ -167,17 +175,15 @@ jobs:
if: |
matrix.artifact-name == 'macOS' && (github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/2027' || startsWith(github.ref, 'refs/tags/v2027')))
- name: Check disk free space (Windows)
run: wmic logicaldisk get caption, freespace
if: matrix.os == 'windows-2022'
- name: Check disk free space (macOS)
run: df -h .
if: matrix.os == 'macOS-15'
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.outputs }}
- name: Check disk free space
if: always()
run: df -h
build-documentation:
name: "Build - Documentation"
runs-on: ubuntu-24.04
@@ -275,7 +281,7 @@ jobs:
needs: [build-docker, build-host, build-documentation]
runs-on: ubuntu-24.04
steps:
- name: Free Disk Space
- name: Free disk space
if: |
github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/2027' || startsWith(github.ref, 'refs/tags/v2027'))
@@ -288,6 +294,7 @@ jobs:
large-packages: false
docker-images: false
swap-storage: false
- uses: actions/checkout@v4
if: |
github.repository == 'wpilibsuite/allwpilib' &&

View File

@@ -53,11 +53,12 @@ jobs:
with:
fetch-depth: 0
- name: Build with Gradle
# main on 2021-05-30, to include addnab/docker-run-action/pull/17
uses: addnab/docker-run-action@3e77f186b7a929ef010f183a9e24c0f9955ea609
with:
image: ${{ matrix.container }}
options: -v ${{ github.workspace }}:/work -w /work -e GITHUB_REF -e CI
run: df . && echo $GITHUB_REF && ./gradlew build -PbuildServer -PskipJavaFormat ${{ matrix.build-options }}
run: ./gradlew build -PbuildServer -PskipJavaFormat ${{ matrix.build-options }}
- name: Check free disk space
run: df .
- uses: actions/upload-artifact@v4