From ed056d20742ea74bfbfb88a202908285c484d69f Mon Sep 17 00:00:00 2001 From: Ruslan Sayfutdinov Date: Fri, 15 Nov 2024 09:56:14 -0800 Subject: [PATCH] buck2/github: use faster Windows runners (#812) 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 --- .github/actions/setup_windows_env/action.yml | 31 +++++++++++++------- .github/workflows/build-and-test.yml | 4 +-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/actions/setup_windows_env/action.yml b/.github/actions/setup_windows_env/action.yml index 63180d366991a..069c97aab84ed 100644 --- a/.github/actions/setup_windows_env/action.yml +++ b/.github/actions/setup_windows_env/action.yml @@ -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 diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index ebd726579f4f9..089de65260bcd 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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/checkout@v4.1.0 - uses: ./.github/actions/setup_windows_env @@ -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/checkout@v4.1.0 - uses: ./.github/actions/setup_windows_env