windows: Use setup-dev-driver.ps1 to create dev driver (#24196)
Closes #ISSUE Release Notes: - N/A
This commit is contained in:
parent
c50cb90d6f
commit
bce9a9a6f4
2 changed files with 40 additions and 23 deletions
35
.github/workflows/ci.yml
vendored
35
.github/workflows/ci.yml
vendored
|
@ -236,58 +236,47 @@ jobs:
|
||||||
runs-on: hosted-windows-1
|
runs-on: hosted-windows-1
|
||||||
steps:
|
steps:
|
||||||
# more info here:- https://github.com/rust-lang/cargo/issues/13020
|
# more info here:- https://github.com/rust-lang/cargo/issues/13020
|
||||||
- name: Create Dev Drive using ReFS
|
|
||||||
run: |
|
|
||||||
$Volume = New-VHD -Path C:/zed_dev_drive.vhdx -SizeBytes 30GB |
|
|
||||||
Mount-VHD -Passthru |
|
|
||||||
Initialize-Disk -Passthru |
|
|
||||||
New-Partition -AssignDriveLetter -UseMaximumSize |
|
|
||||||
Format-Volume -FileSystem ReFS -Confirm:$false -Force
|
|
||||||
Write-Output $Volume
|
|
||||||
Write-Output "DEV_DRIVE=$($Volume.DriveLetter):" >> $env:GITHUB_ENV
|
|
||||||
- name: Enable longer pathnames for git
|
- name: Enable longer pathnames for git
|
||||||
run: git config --system core.longpaths true
|
run: git config --system core.longpaths true
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
with:
|
with:
|
||||||
clean: false
|
clean: false
|
||||||
|
|
||||||
|
- name: Create Dev Drive using ReFS
|
||||||
|
run: ./script/setup-dev-driver.ps1
|
||||||
|
|
||||||
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
|
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
|
||||||
- name: Copy Git Repo to Dev Drive
|
- name: Copy Git Repo to Dev Drive
|
||||||
run: |
|
run: |
|
||||||
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/zed" -Recurse
|
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.ZED_WORKSPACE }}" -Recurse
|
||||||
|
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2
|
uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2
|
||||||
with:
|
with:
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
workspaces: ${{ env.DEV_DRIVE }}/zed
|
workspaces: ${{ env.ZED_WORKSPACE }}
|
||||||
cache-provider: "github"
|
cache-provider: "github"
|
||||||
env:
|
|
||||||
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
|
|
||||||
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
|
|
||||||
|
|
||||||
- name: Configure CI
|
- name: Configure CI
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ${{ env.DEV_DRIVE }}/.cargo -ErrorAction Ignore
|
mkdir -p ${{ env.CARGO_HOME }} -ErrorAction Ignore
|
||||||
cp ./.cargo/ci-config.toml ${{ env.DEV_DRIVE }}/.cargo/config.toml
|
cp ./.cargo/ci-config.toml ${{ env.CARGO_HOME }}/config.toml
|
||||||
|
|
||||||
- name: cargo clippy
|
- name: cargo clippy
|
||||||
|
working-directory: ${{ env.ZED_WORKSPACE }}
|
||||||
# Windows can't run shell scripts, so we need to use `cargo xtask`.
|
# Windows can't run shell scripts, so we need to use `cargo xtask`.
|
||||||
run: cargo xtask clippy
|
run: cargo xtask clippy
|
||||||
env:
|
|
||||||
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
|
|
||||||
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
|
|
||||||
|
|
||||||
- name: Build Zed
|
- name: Build Zed
|
||||||
|
working-directory: ${{ env.ZED_WORKSPACE }}
|
||||||
run: cargo build
|
run: cargo build
|
||||||
env:
|
|
||||||
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
|
|
||||||
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
|
|
||||||
|
|
||||||
# Since the Windows runners are stateful, so we need to remove the config file to prevent potential bug.
|
# Since the Windows runners are stateful, so we need to remove the config file to prevent potential bug.
|
||||||
- name: Clean CI config file
|
- name: Clean CI config file
|
||||||
if: always()
|
if: always()
|
||||||
run: Remove-Item -Path "${{ env.DEV_DRIVE }}/.cargo/config.toml" -Force
|
run: Remove-Item -Path "${{ env.CARGO_HOME }}/config.toml" -Force
|
||||||
|
|
||||||
bundle-mac:
|
bundle-mac:
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
|
|
28
script/setup-dev-driver.ps1
Normal file
28
script/setup-dev-driver.ps1
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Configures a drive for testing in CI.
|
||||||
|
# todo(windows)
|
||||||
|
# The current version of the Windows runner is 10.0.20348 which does not support DevDrive option.
|
||||||
|
# Ref: https://learn.microsoft.com/en-us/windows/dev-drive/
|
||||||
|
|
||||||
|
$Volume = New-VHD -Path C:/zed_dev_drive.vhdx -SizeBytes 30GB |
|
||||||
|
Mount-VHD -Passthru |
|
||||||
|
Initialize-Disk -Passthru |
|
||||||
|
New-Partition -AssignDriveLetter -UseMaximumSize |
|
||||||
|
Format-Volume -FileSystem ReFS -Confirm:$false -Force
|
||||||
|
|
||||||
|
$Drive = "$($Volume.DriveLetter):"
|
||||||
|
|
||||||
|
# Show some debug information
|
||||||
|
Write-Output $Volume
|
||||||
|
Write-Output "Using Dev Drive at $Drive"
|
||||||
|
|
||||||
|
# Move Cargo to the dev drive
|
||||||
|
New-Item -Path "$($Drive)/.cargo/bin" -ItemType Directory -Force
|
||||||
|
Copy-Item -Path "C:/Users/runneradmin/.cargo/*" -Destination "$($Drive)/.cargo/" -Recurse -Force
|
||||||
|
|
||||||
|
Write-Output `
|
||||||
|
"DEV_DRIVE=$($Drive)" `
|
||||||
|
"RUSTUP_HOME=$($Drive)/.rustup" `
|
||||||
|
"CARGO_HOME=$($Drive)/.cargo" `
|
||||||
|
"ZED_WORKSPACE=$($Drive)/zed" `
|
||||||
|
"PATH=$($Drive)/.cargo/bin;$env:PATH" `
|
||||||
|
>> $env:GITHUB_ENV
|
Loading…
Add table
Add a link
Reference in a new issue