diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index e1aca763a6a..7e27fadc09d 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -46,15 +46,6 @@ runs: with: python-version: '3.11' - - name: Install Hyper-V Module (if needed) - if: runner.os == 'Windows' - shell: pwsh - run: | - # Install Hyper-V module if it's not already installed - if (-not (Get-Module -ListAvailable -Name "Hyper-V")) { - Install-WindowsFeature -Name Hyper-V -IncludeAllSubFeature - } - - name: Setup Virtual Drive on MacOS if: runner.os == 'macOS' shell: bash @@ -71,17 +62,23 @@ runs: dd if=/dev/zero of=virtual_test_disk.img bs=1M count=4096 virtual_path=$(sudo losetup -f --show virtual_test_disk.img) echo "TARGET_DRIVE=${virtual_path}" >> $GITHUB_ENV - echo "ETCHER_INCLUDE_VIRTUAL_DRIVES=1" >> $GITHUB_ENV - name: Setup Virtual Drive on Windows if: runner.os == 'Windows' shell: pwsh run: | - New-VHD -Path virtual_test_disk.vhdx -SizeBytes 4GB - $vhd = Mount-VHD -Path "virtual_test_disk.vhdx" -Passthru - $disk = Get-Disk -Number $vhd.Number - echo "TARGET_DRIVE=$($disk.DeviceId)" >> $env:GITHUB_ENV - echo "ETCHER_INCLUDE_VIRTUAL_DRIVES=1" >> $env:GITHUB_ENV + fsutil file createnew virtual_test_disk.img 4GB + + echo SELECT VDISK FILE=virtual_test_disk.img > mount_script.txt + echo ATTACH VDISK >> mount_script.txt + diskpart /s mount_script.txt + + echo LIST VOLUME > list_volumes.txt + for /f "tokens=1-3" %%a in ('diskpart /s list_volumes.txt') do ( + if "%%c"=="virtual_test_disk.img" ( + echo "TARGET_DRIVE=%%a:\\" >> %GITHUB_ENV% + ) + ) - name: Test release shell: bash