Skip to content

Commit 40c37ed

Browse files
authored
Merge pull request #5803 from cloudflare/dlapid/ci-improvements2
Improve Windows CI build performance
2 parents 79a7661 + 07a9275 commit 40c37ed

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

.github/actions/setup-runner/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ runs:
3434
if: runner.os == 'Windows'
3535
# Set a custom output root directory to avoid long file name issues.
3636
run: |
37+
# Enable Developer Mode to allow Bazel to create real symlinks
38+
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
3739
git config --global core.symlinks true
3840
git config --show-scope --show-origin core.symlinks
3941
git config --system core.longpaths true

.github/workflows/_bazel.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,13 @@ jobs:
144144
run: |
145145
bazel build --config=parse_headers --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --config=ci ${{ inputs.extra_bazel_args }} //src/workerd/util
146146
- name: Upload test logs
147-
if: inputs.upload_test_logs
147+
if: always() && inputs.upload_test_logs
148148
uses: actions/upload-artifact@v4
149149
with:
150150
name: test-logs-${{ inputs.os_name }}-${{ inputs.arch_name }}${{ inputs.suffix }}.zip
151151
path: bazel-testlogs/**/test.xml
152152
- name: Report disk usage (in MB)
153-
# This step takes a few seconds on Mac and Linux but takes 16 minutes on Windows for
154-
# some reason. It doesn't seem important enough to wait for 16 minutes on every build.
155-
if: runner.os != 'Windows'
153+
if: always() && runner.os != 'Windows'
156154
shell: bash
157155
run: |
158156
BAZEL_OUTPUT_BASE=$(bazel info output_base)
@@ -163,6 +161,26 @@ jobs:
163161
du -ms -t 1 $BAZEL_OUTPUT_BASE
164162
echo "Workspace usage statistics"
165163
du -ms -t 1 $GITHUB_WORKSPACE
164+
- name: Report disk usage (in MB)
165+
if: always() && runner.os == 'Windows'
166+
shell: pwsh
167+
run: |
168+
function Get-SizeMB($path) {
169+
if (Test-Path $path) {
170+
$size = (Get-ChildItem -Path $path -Recurse -Force -ErrorAction SilentlyContinue |
171+
Measure-Object -Property Length -Sum -ErrorAction SilentlyContinue).Sum
172+
[math]::Round($size / 1MB)
173+
} else { 0 }
174+
}
175+
$outputBase = bazel info output_base 2>$null
176+
$repoCache = bazel info repository_cache 2>$null
177+
echo "Bazel cache usage statistics"
178+
echo "$(Get-SizeMB $env:USERPROFILE\bazel-disk-cache)`t$env:USERPROFILE\bazel-disk-cache"
179+
echo "$(Get-SizeMB $repoCache)`t$repoCache"
180+
echo "Bazel output usage statistics"
181+
echo "$(Get-SizeMB $outputBase)`t$outputBase"
182+
echo "Workspace usage statistics"
183+
echo "$(Get-SizeMB $env:GITHUB_WORKSPACE)`t$env:GITHUB_WORKSPACE"
166184
167185
- name: Upload binary
168186
if: inputs.upload_binary
@@ -172,7 +190,7 @@ jobs:
172190
path: bazel-bin/src/workerd/server/workerd${{ runner.os == 'Windows' && '.exe' || '' }}
173191
if-no-files-found: error
174192
- name: Upload build statistics
175-
if: inputs.run_tests
193+
if: always() && inputs.run_tests
176194
uses: actions/upload-artifact@v4
177195
with:
178196
name: ${{ inputs.os_name }}${{ inputs.arch_name }}${{ inputs.suffix }}-bazel-profile
@@ -196,5 +214,6 @@ jobs:
196214
fi
197215
198216
- name: Bazel shutdown
217+
if: always()
199218
# Check that there are no .bazelrc issues that prevent shutdown.
200219
run: bazel shutdown

0 commit comments

Comments
 (0)