2626 required : false
2727 type : string
2828 default : ' '
29- caching :
30- description : Toggle caching of Bazel
31- required : false
32- type : boolean
33- default : true
3429 node-version :
3530 description : Custom Node version to install
3631 required : false
7671 required : false
7772 type : string
7873 default : ' '
74+ cache-save :
75+ description : Save the Bazel cache after the run (avoids multiple jobs clobbering it)
76+ required : false
77+ type : boolean
78+ default : false
7979 gem-trusted-publishing :
8080 description : Exchange GitHub OIDC token for a RubyGems API token (requires trusted publisher configured on rubygems.org)
8181 required : false
9595 GEM_HOST_API_KEY : ${{ secrets.GEM_HOST_API_KEY }}
9696 NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
9797 steps :
98- - name : Remove extra tools to free disk space
99- if : inputs.os == 'ubuntu'
100- run : |
101- echo "Removing extra tools to free disk space..."
102- echo "Space before: $(df -BG / | tail -1 | awk '{print $4}')"
103- sudo rm -rf /opt/ghc || true
104- sudo rm -rf /usr/local/.ghcup || true
105- sudo rm -rf /usr/local/share/boost || true
106- sudo rm -rf /usr/share/swift || true
107- sudo rm -rf /usr/local/julia* || true
108- sync
109- after=$(df -BG / | tail -1 | awk '{print $4}')
110- echo "Space after: ${after}"
11198 - name : Calculate fetch depth
11299 id : depth
113100 shell : bash
@@ -134,31 +121,30 @@ jobs:
134121 fetch-tags : ${{ inputs.fetch-depth != '' }}
135122 - name : Pull latest changes from head ref for PRs
136123 if : contains(github.head_ref, 'renovate/')
124+ shell : bash
137125 run : git pull origin "$HEAD_REF"
138126 env :
139127 HEAD_REF : ${{ github.head_ref }}
140128 - name : Pull latest changes from ref for branch pushes
141129 if : contains(github.ref, 'renovate/')
130+ shell : bash
142131 run : git pull origin "$GIT_REF"
143132 env :
144133 GIT_REF : ${{ github.ref }}
134+ - name : Free disk space
135+ if : inputs.os == 'ubuntu'
136+ run : ./scripts/github-actions/free-disk-space.sh
137+ - name : Free disk space (Windows)
138+ if : inputs.os == 'windows'
139+ shell : pwsh
140+ run : ./scripts/github-actions/free-disk-space.ps1
145141 - name : Restore cache
146142 if : inputs.cache-name != ''
147143 uses : actions/cache/restore@v5
148144 with :
149145 path : ${{ inputs.cache-name }}
150146 key : ${{ inputs.cache-name }}-
151147 restore-keys : ${{ inputs.cache-name }}-
152- - name : Remove driver directories Windows
153- if : inputs.os == 'windows'
154- run : |
155- rm "$env:ChromeWebDriver" -r -v
156- rm "$env:EdgeWebDriver" -r -v
157- rm "$env:GeckoWebDriver" -r -v
158- - name : Remove driver directories Non-Windows
159- if : inputs.os != 'windows'
160- run : |
161- sudo rm -rf "$CHROMEWEBDRIVER" "$EDGEWEBDRIVER" "$GECKOWEBDRIVER"
162148 - name : Set Python version
163149 if : inputs.python-version != ''
164150 run : echo '${{ inputs.python-version }}' > py/.python-version
@@ -171,50 +157,21 @@ jobs:
171157 with :
172158 node-version : ${{ inputs.node-version }}
173159 - name : Setup Bazel with caching
174- if : inputs.caching
160+ continue-on-error : true
175161 uses : bazel-contrib/setup-bazel@0.19.0
176162 with :
177- cache-save : ${{ github.ref_name == 'trunk' }}
163+ cache-save : ${{ inputs.cache-save }}
178164 bazelisk-cache : true
179165 bazelrc : common --color=yes
180166 # Workaround for long path issues: https://github.com/bazelbuild/bazel/pull/22532
181167 output-base : ${{ inputs.os == 'windows' && 'D://b' || '' }}
182- cache-version : 2
183168 disk-cache : false
184- external-cache : |
185- manifest:
186- crates: rust/Cargo.Bazel.lock
187- "rules_ruby++ruby+ruby": false
188- "+pin_browsers_extension+linux_beta_chrome": false
189- "+pin_browsers_extension+linux_beta_chromedriver": true
190- "+pin_browsers_extension+linux_beta_firefox": false
191- "+pin_browsers_extension+linux_chrome": false
192- "+pin_browsers_extension+linux_chromedriver": true
193- "+pin_browsers_extension+linux_edge": false
194- "+pin_browsers_extension+linux_edgedriver": true
195- "+pin_browsers_extension+linux_firefox": false
196- "+pin_browsers_extension+linux_geckodriver": true
197- "+pin_browsers_extension+mac_beta_chrome": false
198- "+pin_browsers_extension+mac_beta_chromedriver": false
199- "+pin_browsers_extension+mac_beta_firefox": false
200- "+pin_browsers_extension+mac_chrome": false
201- "+pin_browsers_extension+mac_chromedriver": false
202- "+pin_browsers_extension+mac_edge": false
203- "+pin_browsers_extension+mac_edgedriver": false
204- "+pin_browsers_extension+mac_firefox": false
205- "+pin_browsers_extension+mac_geckodriver": false
206- repository-cache : true
207- - name : Setup Bazel without caching
208- if : inputs.caching == false
209- uses : bazel-contrib/setup-bazel@0.19.0
210- with :
211- cache-save : false
212- bazelisk-cache : true
213- external-cache : |
214- manifest:
215- crates: rust/Cargo.Bazel.lock
169+ external-cache : false
216170 repository-cache : true
217- bazelrc : common --color=yes
171+ - name : Disk status after cache restore
172+ if : inputs.os != 'macos'
173+ shell : bash
174+ run : . ./scripts/github-actions/disk-status.sh
218175 - name : Setup Fluxbox and Xvfb
219176 if : inputs.os == 'ubuntu' && inputs.browser != ''
220177 run : |
@@ -240,8 +197,18 @@ jobs:
240197 - name : Configure RubyGems credentials via OIDC
241198 if : inputs.gem-trusted-publishing
242199 uses : rubygems/configure-rubygems-credentials@main
200+ - name : Disk status before build
201+ if : inputs.os != 'macos'
202+ shell : bash
203+ run : |
204+ . ./scripts/github-actions/disk-status.sh
205+ if [ "$AVAIL_GB" -lt 10 ]; then
206+ echo "::error::Insufficient disk space: ${AVAIL_GB}GB available (need >=10GB)"
207+ exit 1
208+ fi
243209 - name : Run Bazel
244210 id : run-bazel
211+ continue-on-error : true
245212 shell : bash
246213 env :
247214 MSYS_NO_PATHCONV : 1
@@ -252,15 +219,16 @@ jobs:
252219 ${{ inputs.run }}
253220 } 2>&1 | tee build/bazel-console.log
254221 - name : Rerun failures with debug
255- if : failure() && steps.run-bazel.outcome == 'failure'
222+ id : rerun-failures
223+ if : steps.run-bazel.outcome == 'failure'
256224 shell : bash
257225 run : ./scripts/github-actions/rerun-failures.sh '${{ inputs.run }}' '${{ inputs.rerun-with-debug }}'
258226 - name : Collect failed test logs
259- if : failure () && steps.run-bazel.outcome == 'failure'
227+ if : always () && steps.run-bazel.outcome == 'failure'
260228 shell : bash
261229 run : ./scripts/github-actions/collect-test-logs.sh
262230 - name : Upload failed test logs
263- if : failure () && steps.run-bazel.outcome == 'failure'
231+ if : always () && steps.run-bazel.outcome == 'failure'
264232 uses : actions/upload-artifact@v7
265233 with :
266234 name : test-logs-${{ inputs.os }}-${{ inputs.name }}-${{ inputs.browser }}
@@ -285,13 +253,11 @@ jobs:
285253 path : ${{ inputs.artifact-path || 'changes.patch' }}
286254 retention-days : 6
287255 if-no-files-found : ${{ inputs.artifact-path != '' && 'error' || 'ignore' }}
288- - name : Check disk space
256+ - name : Low Disk Warning
289257 if : always()
290258 shell : bash
291259 run : |
292- avail=$(df -k "$GITHUB_WORKSPACE" | awk 'NR==2 {printf "%.0f", $4/1024/1024}')
293- echo "Remaining disk space: ${avail}GB"
294- if [ "$avail" -lt 5 ]; then
295- echo "::error::Low disk space: ${avail}GB remaining"
296- exit 1
260+ . ./scripts/github-actions/disk-status.sh
261+ if [ "$AVAIL_GB" -lt 5 ]; then
262+ echo "::warning::Low disk space: ${AVAIL_GB}GB remaining"
297263 fi
0 commit comments