From a0f4727179e4b4c880e20869cbd2223f042e9281 Mon Sep 17 00:00:00 2001 From: Austin Schuh Date: Tue, 11 Nov 2025 18:03:47 -0800 Subject: [PATCH] [ci] Run each of the various bazel builds in a separate worker (#8363) We are running out of disk space. If we split the build up more in parallel, that'll use less space in each build. Signed-off-by: Austin Schuh --- .github/workflows/bazel.yml | 102 +++++++++++++++++------------------- 1 file changed, 49 insertions(+), 53 deletions(-) diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index c42fb61f19..a8e7b5736e 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -7,70 +7,47 @@ concurrency: cancel-in-progress: true jobs: - build-windows: + build: strategy: fail-fast: false matrix: include: - - { name: "Windows (native)", os: windows-2022, action: "test", config: "--config=ci_windows_x86", } - - { name: "Windows (arm)", os: windows-2022, action: "build", config: "--config=windows_arm --config=ci_windows_arm", } + - { 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: "Build ${{ matrix.name }}" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - with: { fetch-depth: 0 } - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 21 - architecture: x64 + - { name: "macOS", classifier: "osxuniversal,osxuniversaldebug,headers,sources,osxuniversalstatic,osxuniversalstaticdebug,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug", os: macOS-15, action: "test" } - - id: Setup_bazel_remote - uses: ./.github/actions/setup-bazel-remote - with: - username: ${{ secrets.BAZEL_CACHE_USERNAME }} - password: ${{ secrets.BAZEL_CACHE_PASSWORD }} + - { name: "Windows x86-64", classifier: "windowsx86-64,windowsx86-64debug,headers,sources", os: windows-2022, action: "test" } + - { name: "Windows x86-64 Static", classifier: "windowsx86-64static,windowsx86-64staticdebug", os: windows-2022, action: "test" } - - name: bazel ${{ matrix.action }} - run: bazel --output_user_root=C:\\bazelroot ${{ matrix.action }} ... --config=ci ${{ matrix.config }} - shell: bash + - { name: "Windows ARM64", classifier: "windowsarm64,windowsarm64debug", os: windows-2022, action: "build" } + - { name: "Windows ARM64 Static", classifier: "windowsarm64static,windowsarm64staticdebug", os: windows-2022, action: "build" } - build-mac: - name: "Mac" - runs-on: macOS-15 - steps: - - uses: actions/checkout@v4 - with: { fetch-depth: 0 } + - { name: "Windows System Core", classifier: "linuxsystemcore,linuxsystemcoredebug", os: windows-2022, action: "build" } + - { name: "Windows System Core Static", classifier: "linuxsystemcorestatic,linuxsystemcorestaticdebug", os: windows-2022, action: "build" } - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 21 - - - id: Setup_bazel_remote - uses: ./.github/actions/setup-bazel-remote - with: - username: ${{ secrets.BAZEL_CACHE_USERNAME }} - password: ${{ secrets.BAZEL_CACHE_PASSWORD }} - - - name: bazel test (release) - run: bazel test ... --config=ci -c opt --nojava_header_compilation - shell: bash - - build-linux: - strategy: - fail-fast: false - matrix: - include: - - { name: "Linux", os: ubuntu-24.04, container: "wpilib/systemcore-cross-ubuntu:2027-24.04", action: "test", config: "", } - name: "${{ matrix.name }}" + name: "${{ matrix.action == 'test' && 'Test' || 'Build' }} ${{ matrix.name }}" runs-on: ${{ matrix.os }} container: ${{ matrix.container }} steps: - uses: actions/checkout@v4 with: { fetch-depth: 0 } - - uses: bazelbuild/setup-bazelisk@v3 + + - if: matrix.os == 'windows-2022' || matrix.os == 'macOS-15' + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 21 + architecture: x64 + + - if: matrix.os == 'ubuntu-24.04' + uses: bazelbuild/setup-bazelisk@v3 - id: Setup_bazel_remote uses: ./.github/actions/setup-bazel-remote @@ -78,14 +55,33 @@ jobs: username: ${{ secrets.BAZEL_CACHE_USERNAME }} password: ${{ secrets.BAZEL_CACHE_PASSWORD }} - - uses: bazel-contrib/setup-bazel@0.15.0 + - if: matrix.os == 'ubuntu-24.04' + uses: bazel-contrib/setup-bazel@0.15.0 with: bazelisk-cache: true repository-cache: true bazelisk-version: 1.x - - name: bazel ${{ matrix.action }} (release) - run: bazel ${{ matrix.action }} ... --config=ci -c opt ${{ matrix.config }} + - name: bazel ${{ matrix.action }} + run: | + if [[ "${{ matrix.os }}" == "windows-2022" ]]; then + bazel --output_user_root=C:\\bazelroot ${{ matrix.action }} ... --config=ci -c opt --repo_env=WPI_PUBLISH_CLASSIFIER_FILTER='${{ matrix.classifier }}' + elif [[ "${{ matrix.os }}" == "macOS-15" ]]; then + bazel ${{ matrix.action }} ... --config=ci -c opt --nojava_header_compilation --repo_env=WPI_PUBLISH_CLASSIFIER_FILTER='${{ matrix.classifier }}' + else + bazel ${{ matrix.action }} ... --config=ci -c opt --repo_env=WPI_PUBLISH_CLASSIFIER_FILTER='${{ matrix.classifier }}' + fi + shell: bash + + - name: Free Space + if: always() + shell: bash + run: | + if [[ "${{ matrix.os }}" == "windows-2022" ]]; then + fsutil volume diskfree C: + else + df -h / + fi buildifier: name: "buildifier"