Skip to content

Commit 809c368

Browse files
committed
ci: optimize Windows Rust builds with Dev Drive and static CRT
- Add Dev Drive setup for Windows CI jobs to bypass filesystem overhead - Enable long paths support for Windows builds - Add static CRT linking configuration for Windows targets
1 parent 6467968 commit 809c368

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

.cargo/config.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,16 @@ bindeps = true
1313

1414
[net]
1515
git-fetch-with-cli = true # use git CLI to authenticate for vite-task git dependencies
16+
17+
# Windows-specific optimizations for faster builds
18+
[target.x86_64-pc-windows-msvc]
19+
rustflags = ["-C", "target-feature=+crt-static"]
20+
21+
[target.i686-pc-windows-msvc]
22+
rustflags = ["-C", "target-feature=+crt-static"]
23+
24+
[target.aarch64-pc-windows-msvc]
25+
rustflags = ["-C", "target-feature=+crt-static"]
26+
27+
[target.'cfg(target_os = "windows")']
28+
rustflags = ["-C", "link-args=/NODEFAULTLIB:libucrt.lib", "-C", "link-args=/DEFAULTLIB:ucrt.lib"]

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ jobs:
4949
target: aarch64-apple-darwin
5050
runs-on: ${{ matrix.os }}
5151
steps:
52+
- name: Setup Dev Drive
53+
if: ${{ matrix.os == 'windows-latest' }}
54+
uses: samypr100/setup-dev-drive@30f0f98ae5636b2b6501e181dfb3631b9974818d # v4.0.0
55+
with:
56+
workspace-copy: true
57+
drive-size: 8GB
58+
drive-format: NTFS
59+
env-mapping: |
60+
CARGO_HOME,{{ DEV_DRIVE }}/.cargo
61+
RUSTUP_HOME,{{ DEV_DRIVE }}/.rustup
62+
63+
- name: Enable long paths on Windows
64+
if: ${{ matrix.os == 'windows-latest' }}
65+
run: git config --system core.longpaths true
66+
5267
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
5368
- uses: ./.github/actions/clone
5469

@@ -157,6 +172,21 @@ jobs:
157172
- os: windows-latest
158173
runs-on: ${{ matrix.os }}
159174
steps:
175+
- name: Setup Dev Drive
176+
if: ${{ matrix.os == 'windows-latest' }}
177+
uses: samypr100/setup-dev-drive@30f0f98ae5636b2b6501e181dfb3631b9974818d # v4.0.0
178+
with:
179+
workspace-copy: true
180+
drive-size: 8GB
181+
drive-format: NTFS
182+
env-mapping: |
183+
CARGO_HOME,{{ DEV_DRIVE }}/.cargo
184+
RUSTUP_HOME,{{ DEV_DRIVE }}/.rustup
185+
186+
- name: Enable long paths on Windows
187+
if: ${{ matrix.os == 'windows-latest' }}
188+
run: git config --system core.longpaths true
189+
160190
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
161191
- uses: ./.github/actions/clone
162192

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ jobs:
2828
- target: x86_64-pc-windows-msvc
2929
os: windows-latest
3030
steps:
31+
- name: Setup Dev Drive
32+
if: ${{ matrix.settings.target == 'x86_64-pc-windows-msvc' }}
33+
uses: samypr100/setup-dev-drive@30f0f98ae5636b2b6501e181dfb3631b9974818d # v4.0.0
34+
with:
35+
workspace-copy: true
36+
drive-size: 8GB
37+
drive-format: NTFS
38+
env-mapping: |
39+
CARGO_HOME,{{ DEV_DRIVE }}/.cargo
40+
RUSTUP_HOME,{{ DEV_DRIVE }}/.rustup
41+
42+
- name: Enable long paths on Windows
43+
if: ${{ matrix.settings.target == 'x86_64-pc-windows-msvc' }}
44+
run: git config --system core.longpaths true
45+
3146
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3247
- uses: ./.github/actions/clone
3348
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0

0 commit comments

Comments
 (0)