Skip to content

Commit 8b2052e

Browse files
committed
[CI] Use temporary storage driver on Windows to speed up build.
1 parent f40270a commit 8b2052e

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,25 @@ jobs:
3535
java: [ '17', '21', '25' ]
3636
os: [ 'ubuntu-24.04', 'windows-latest', 'macos-15' ]
3737
steps:
38+
- name: Use faster temporary storage (Windows)
39+
if: runner.os == 'Windows'
40+
run: |
41+
$fast_dir = "D:\fast-dir"
42+
New-Item -ItemType Directory -Path "$fast_dir"
43+
New-Item -ItemType Directory -Path "$fast_dir\temp"
44+
New-Item -ItemType Directory -Path "$fast_dir\.m2"
45+
New-Item -ItemType Directory -Path "$fast_dir\.gradle"
46+
47+
if (Test-Path "$env:userprofile\.m2")
48+
{
49+
Remove-Item "$env:userprofile\.m2" -Recurse
50+
}
51+
New-Item -ItemType SymbolicLink -Path "$env:userprofile\.m2" -Target "$fast_dir\.m2"
52+
53+
echo "TMP=$fast_dir\temp" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
54+
echo "TEMP=$fast_dir\temp" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
55+
echo "M2_HOME=$fast_dir\.m2" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
56+
echo "GRADLE_USER_HOME=$fast_dir\.gradle" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
3857
- name: Checkout code
3958
uses: actions/checkout@v5
4059
with:
@@ -242,6 +261,24 @@ jobs:
242261
CC: cl
243262
CXX: cl
244263
steps:
264+
- name: Use faster temporary storage (Windows)
265+
run: |
266+
$fast_dir = "D:\fast-dir"
267+
New-Item -ItemType Directory -Path "$fast_dir"
268+
New-Item -ItemType Directory -Path "$fast_dir\temp"
269+
New-Item -ItemType Directory -Path "$fast_dir\.m2"
270+
New-Item -ItemType Directory -Path "$fast_dir\.gradle"
271+
272+
if (Test-Path "$env:userprofile\.m2")
273+
{
274+
Remove-Item "$env:userprofile\.m2" -Recurse
275+
}
276+
New-Item -ItemType SymbolicLink -Path "$env:userprofile\.m2" -Target "$fast_dir\.m2"
277+
278+
echo "TMP=$fast_dir\temp" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
279+
echo "TEMP=$fast_dir\temp" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
280+
echo "M2_HOME=$fast_dir\.m2" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
281+
echo "GRADLE_USER_HOME=$fast_dir\.gradle" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
245282
- name: Checkout code
246283
uses: actions/checkout@v5
247284
with:

0 commit comments

Comments
 (0)