Skip to content

Commit

Permalink
buck2/github: use faster Windows runners (facebook#812)
Browse files Browse the repository at this point in the history
Summary:

For some reason Cargo builds are at least twice slower on Windows than on Linux or MacOS on Github. I checked this is true for other popular Rust projects as well.

We can use faster 8-core runners instead of 2-core to reduce this difference.

Differential Revision:
D66011530

Privacy Context Container: L1123788
  • Loading branch information
KapJI authored and facebook-github-bot committed Nov 15, 2024
1 parent 093aabe commit ed056d2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
31 changes: 20 additions & 11 deletions .github/actions/setup_windows_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@ description: Setup Windows environment for building and testing
runs:
using: composite
steps:
- name: Configure Cargo and Rustup to use drive D
run: |
New-Item -ItemType Directory -Path D:\rustup
New-Item -ItemType Directory -Path D:\cargo
New-Item -ItemType Directory -Path D:\temp
"RUSTUP_HOME=D:\rustup" | Out-File -FilePath $env:GITHUB_ENV -Append
"CARGO_HOME=D:\cargo" | Out-File -FilePath $env:GITHUB_ENV -Append
"TEMP=D:\temp" | Out-File -FilePath $env:GITHUB_ENV -Append
"TMP=D:\temp" | Out-File -FilePath $env:GITHUB_ENV -Append
"D:\cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
shell: pwsh
# - name: Configure Cargo and Rustup to use drive D
# run: |
# New-Item -ItemType Directory -Path D:\rustup
# New-Item -ItemType Directory -Path D:\cargo
# New-Item -ItemType Directory -Path D:\temp
# "RUSTUP_HOME=D:\rustup" | Out-File -FilePath $env:GITHUB_ENV -Append
# "CARGO_HOME=D:\cargo" | Out-File -FilePath $env:GITHUB_ENV -Append
# "TEMP=D:\temp" | Out-File -FilePath $env:GITHUB_ENV -Append
# "TMP=D:\temp" | Out-File -FilePath $env:GITHUB_ENV -Append
# "D:\cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
# shell: pwsh
- uses: samypr100/setup-dev-drive@v3
with:
drive-size: 30GB
env-mapping: |
RUSTUP_HOME,{{ DEV_DRIVE }}/rustup
CARGO_HOME,{{ DEV_DRIVE }}/cargo
CARGO_TARGET_DIR,{{ DEV_DRIVE }}/target
TEMP,{{ DEV_DRIVE }}/temp
TMP,{{ DEV_DRIVE }}/temp
- name: Write Visual Studio path
run: |-
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.VisualStudio.Component.VC.Llvm.Clang -property installationPath
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: ./.github/actions/build_debug
- uses: ./.github/actions/run_test_py
windows-build-and-test:
runs-on: windows-latest
runs-on: windows-8-core
steps:
- uses: actions/[email protected]
- uses: ./.github/actions/setup_windows_env
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
- uses: ./.github/actions/setup_reindeer
- uses: ./.github/actions/build_bootstrap
windows-build-examples:
runs-on: windows-latest
runs-on: windows-8-core
steps:
- uses: actions/[email protected]
- uses: ./.github/actions/setup_windows_env
Expand Down

0 comments on commit ed056d2

Please sign in to comment.