From 90288f06a6958dde04b7dcd7bd9c9cab15ea569f Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 29 Sep 2023 00:50:15 -0700 Subject: [PATCH] [ci] Fix Gradle disk space issues (#5688) - Free up disk space on Linux by deleting unused packages - Move build to C drive on Windows --- .github/workflows/gradle.yml | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 65380ee86b..866f2aa88b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -27,6 +27,16 @@ jobs: name: "Build - ${{ matrix.artifact-name }}" runs-on: ubuntu-22.04 steps: + - name: Free Disk Space + 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 - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -38,7 +48,9 @@ jobs: with: image: ${{ matrix.container }} options: -v ${{ github.workspace }}:/work -w /work -e ARTIFACTORY_PUBLISH_USERNAME=${{ secrets.ARTIFACTORY_USERNAME }} -e ARTIFACTORY_PUBLISH_PASSWORD=${{ secrets.ARTIFACTORY_PASSWORD }} - run: ./gradlew build --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }} + run: df . && ./gradlew build --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }} + - name: Check free disk space + run: df . - uses: actions/upload-artifact@v3 with: name: ${{ matrix.artifact-name }} @@ -57,12 +69,14 @@ jobs: task: "build" build-options: "-PciDebugOnly --max-workers 1" outputs: "build/allOutputs" + build-dir: "c:\\work" - os: windows-2022 artifact-name: Win64Release architecture: x64 build-options: "-PciReleaseOnly --max-workers 1" task: "copyAllOutputs" outputs: "build/allOutputs" + build-dir: "c:\\work" # - os: windows-2022 # artifact-name: WinArm64Debug # architecture: x64 @@ -80,11 +94,13 @@ jobs: architecture: x64 task: "build" outputs: "build/allOutputs" + build-dir: "." - os: windows-2022 artifact-name: Win32 architecture: x86 task: ":ntcoreffi:build" outputs: "ntcoreffi/build/outputs" + build-dir: "c:\\work" name: "Build - ${{ matrix.artifact-name }}" runs-on: ${{ matrix.os }} steps: @@ -117,20 +133,31 @@ jobs: - name: Set Java Heap Size run: sed -i 's/-Xmx2g/-Xmx1g/g' gradle.properties if: matrix.artifact-name == 'Win32' + - name: Configure build directory (Windows) + run: xcopy . ${{ matrix.build-dir }} /i /s /e /h /q + if: matrix.os == 'windows-2022' + - name: Check disk free space (Windows) + run: wmic logicaldisk get caption, freespace + if: matrix.os == 'windows-2022' - name: Build with Gradle run: ./gradlew ${{ matrix.task }} --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }} + working-directory: ${{ matrix.build-dir }} env: ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} - name: Sign Libraries with Developer ID run: ./gradlew copyAllOutputs --build-cache -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }} + working-directory: ${{ matrix.build-dir }} if: | matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))) + - name: Check disk free space (Windows) + run: wmic logicaldisk get caption, freespace + if: matrix.os == 'windows-2022' - uses: actions/upload-artifact@v3 with: name: ${{ matrix.artifact-name }} - path: ${{ matrix.outputs }} + path: ${{ matrix.build-dir }}/${{ matrix.outputs }} build-documentation: name: "Build - Documentation"