ci/msvc: Split the install of rust and d3d out of mesa_deps_test.ps1

There is no need repeatedly downloading rust and d3d when building the docker locally

Download glext.h from github

Remove src directory and .git directory once compiling finished

Split piglit and depq compiling out

Clean middle files of piglit and depq
ci/msvc: Improve fetch source of spirv_samples_source

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26736>
This commit is contained in:
Yonggang Luo
2023-12-21 04:18:39 +08:00
committed by Marge Bot
parent 6e8c3a585a
commit cb50d0cabf
6 changed files with 285 additions and 168 deletions

View File

@@ -6,6 +6,17 @@ FROM ${base_image}
COPY mesa_deps_vulkan_sdk.ps1 C:\
RUN C:\mesa_deps_vulkan_sdk.ps1
COPY mesa_deps_d3d.ps1 C:\
RUN C:\mesa_deps_d3d.ps1
COPY mesa_deps_rust.ps1 C:\
RUN C:\mesa_deps_rust.ps1
COPY mesa_init_msvc.ps1 C:\
COPY mesa_deps_test_piglit.ps1 C:\
RUN C:\mesa_deps_test_piglit.ps1
COPY mesa_deps_test_deqp.ps1 c:\
RUN C:\mesa_deps_test_deqp.ps1
COPY mesa_deps_test.ps1 C:\
RUN C:\mesa_deps_test.ps1

View File

@@ -0,0 +1,49 @@
# Downloading specified D3D runtime
# Touch this file needs update both WINDOWS_X64_BUILD_TAG WINDOWS_X64_TEST_TAG
# This file needs run in administrator mode
$ProgressPreference = "SilentlyContinue"
$depsInstallPath="C:\mesa-deps"
Write-Host "Downloading DirectX 12 Agility SDK at:"
Get-Date
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.Direct3D.D3D12/1.610.2 -OutFile 'agility.zip'
Expand-Archive -Path 'agility.zip' -DestinationPath 'C:\agility'
# Copy Agility SDK into mesa-deps\bin\D3D12
New-Item -ErrorAction SilentlyContinue -ItemType Directory -Path $depsInstallPath\bin -Name 'D3D12'
Copy-Item 'C:\agility\build\native\bin\x64\*.dll' -Destination $depsInstallPath\bin\D3D12
Remove-Item 'agility.zip'
Remove-Item -Recurse 'C:\agility'
Write-Host "Downloading Updated WARP at:"
Get-Date
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/1.0.7.1 -OutFile 'warp.zip'
Expand-Archive -Path 'warp.zip' -DestinationPath 'C:\warp'
# Copy WARP into mesa-deps\bin
Copy-Item 'C:\warp\build\native\amd64\d3d10warp.dll' -Destination $depsInstallPath\bin
Remove-Item 'warp.zip'
Remove-Item -Recurse 'C:\warp'
Write-Host "Downloading DirectXShaderCompiler release at:"
Get-Date
Invoke-WebRequest -Uri https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.7.2207/dxc_2022_07_18.zip -OutFile 'DXC.zip'
Expand-Archive -Path 'DXC.zip' -DestinationPath 'C:\DXC'
# No more need to get dxil.dll from the VS install
Copy-Item 'C:\DXC\bin\x64\*.dll' -Destination 'C:\Windows\System32'
Remove-Item -Recurse 'DXC.zip'
Remove-Item -Recurse 'C:\DXC'
Write-Host "Enabling developer mode at:"
Get-Date
# Create AppModelUnlock if it doesn't exist, required for enabling Developer Mode
$RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
if (-not(Test-Path -Path $RegistryKeyPath)) {
New-Item -Path $RegistryKeyPath -ItemType Directory -Force
}
# Add registry value to enable Developer Mode
New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1 -Force
Write-Host "Complete download D3D at:"
Get-Date

View File

@@ -0,0 +1,17 @@
# Installing rust compiler
# Touch this file needs update both WINDOWS_X64_BUILD_TAG WINDOWS_X64_TEST_TAG
# This file needs run in administrator mode
$ProgressPreference = "SilentlyContinue"
Write-Host "Installing rust at:"
Get-Date
$url = 'https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe';
Write-Host ('Downloading {0} ...' -f $url);
Invoke-WebRequest -Uri $url -OutFile 'rustup-init.exe';
Write-Host "Installing rust toolchain"
.\rustup-init.exe -y;
Remove-Item rustup-init.exe;
Write-Host "Installing rust finished at:"
Get-Date

View File

@@ -1,180 +1,29 @@
Get-Date
Write-Host "Cloning Waffle"
# Compiling tests deps
$ProgressPreference = "SilentlyContinue"
$MyPath = $MyInvocation.MyCommand.Path | Split-Path -Parent
. "$MyPath\mesa_init_msvc.ps1"
git clone --no-progress --single-branch --no-checkout https://gitlab.freedesktop.org/mesa/waffle.git 'C:\src\waffle'
$spirv_samples_source = Join-Path -Path "$PWD" -ChildPath "spirv-samples"
Write-Host "Cloning spirv-samples at:"
Get-Date
New-Item -ItemType Directory -Path "$spirv_samples_source" | Out-Null
Push-Location -Path $spirv_samples_source
git init
git remote add origin https://github.com/dneto0/spirv-samples.git
git fetch --depth 1 origin 36372636df06a24c4e2de1551beee055db01b91d # of branch main
if (!$?) {
Write-Host "Failed to clone Waffle repository"
Write-Host "Failed to fetch spirv-samples repository"
Pop-Location
Exit 1
}
Push-Location -Path C:\src\waffle
git checkout 950a1f35a718bc2a8e1dda75845e52651bb331a7
git checkout FETCH_HEAD
Pop-Location
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path "$spirv_samples_source\.git" | Out-Null
Write-Host "Cloning spirv-samples finished at:"
Get-Date
$waffle_build = New-Item -ItemType Directory -Path "C:\src\waffle" -Name "build"
Push-Location -Path $waffle_build.FullName
Write-Host "Compiling Waffle"
meson setup `
--buildtype=release `
--default-library=static `
--prefix="C:\Waffle" && `
ninja -j32 install
$buildstatus = $?
Pop-Location
Remove-Item -Recurse -Path $waffle_build
if (!$buildstatus) {
Write-Host "Failed to compile or install Waffle"
Exit 1
}
Write-Host "Complete Dockerfile_test at:"
Get-Date
Write-Host "Downloading glext.h"
New-Item -ItemType Directory -Path ".\glext" -Name "GL"
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest -Uri 'https://www.khronos.org/registry/OpenGL/api/GL/glext.h' -OutFile '.\glext\GL\glext.h' | Out-Null
Get-Date
Write-Host "Cloning Piglit"
git clone --no-progress --single-branch --no-checkout https://gitlab.freedesktop.org/mesa/piglit.git 'C:\piglit'
if (!$?) {
Write-Host "Failed to clone Piglit repository"
Exit 1
}
Push-Location -Path C:\piglit
git checkout b41accc83689966f91217fc5b57dbe06202b8c8c
Get-Date
Write-Host "Compiling Piglit"
cmake -S . -B . `
-GNinja `
-DCMAKE_BUILD_TYPE=Release `
-DPIGLIT_USE_WAFFLE=ON `
-DWaffle_INCLUDE_DIRS=C:\Waffle\include\waffle-1 `
-DWaffle_LDFLAGS=C:\Waffle\lib\libwaffle-1.a `
-DGLEXT_INCLUDE_DIR=.\glext && `
ninja -j32
$buildstatus = $?
Pop-Location
if (!$buildstatus) {
Write-Host "Failed to compile Piglit"
Exit 1
}
Get-Date
Write-Host "Cloning spirv-samples"
git clone --no-progress --single-branch --no-checkout https://github.com/dneto0/spirv-samples.git C:\spirv-samples\
Push-Location -Path C:\spirv-samples\
git checkout 36372636df06a24c4e2de1551beee055db01b91d
Pop-Location
Get-Date
Write-Host "Cloning Vulkan and GL Conformance Tests"
$deqp_source = "C:\src\VK-GL-CTS\"
git clone --no-progress --single-branch https://github.com/KhronosGroup/VK-GL-CTS.git -b vulkan-cts-1.3.4 $deqp_source
if (!$?) {
Write-Host "Failed to clone deqp repository"
Exit 1
}
Push-Location -Path $deqp_source
git checkout 56114106d860c121cd6ff0c3b926ddc50c4c11fd
# --insecure is due to SSL cert failures hitting sourceforge for zlib and
# libpng (sigh). The archives get their checksums checked anyway, and git
# always goes through ssh or https.
py .\external\fetch_sources.py --insecure
Pop-Location
Get-Date
$deqp_build = New-Item -ItemType Directory -Path "C:\deqp"
Push-Location -Path $deqp_build.FullName
Write-Host "Compiling deqp"
cmake -S $($deqp_source) `
-B . `
-GNinja `
-DCMAKE_BUILD_TYPE=Release `
-DDEQP_TARGET=default && `
ninja -j32
$buildstatus = $?
Pop-Location
if (!$buildstatus) {
Write-Host "Failed to compile deqp"
Exit 1
}
# Copy test result templates
Copy-Item -Path "$($deqp_source)\doc\testlog-stylesheet\testlog.css" -Destination $deqp_build
Copy-Item -Path "$($deqp_source)\doc\testlog-stylesheet\testlog.xsl" -Destination $deqp_build
# Copy Vulkan must-pass list
$deqp_mustpass = New-Item -ItemType Directory -Path $deqp_build -Name "mustpass"
$root_mustpass = Join-Path -Path $deqp_source -ChildPath "external\vulkancts\mustpass\main"
$files = Get-Content "$($root_mustpass)\vk-default.txt"
foreach($file in $files) {
Get-Content "$($root_mustpass)\$($file)" | Add-Content -Path "$($deqp_mustpass)\vk-main.txt"
}
Remove-Item -Force -Recurse $deqp_source
Get-Date
$url = 'https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe';
Write-Host ('Downloading {0} ...' -f $url);
Invoke-WebRequest -Uri $url -OutFile 'rustup-init.exe';
Write-Host "Installing rust toolchain"
C:\rustup-init.exe -y;
Remove-Item C:\rustup-init.exe;
Get-Date
Write-Host "Installing deqp-runner"
$env:Path += ";$($env:USERPROFILE)\.cargo\bin"
cargo install --git https://gitlab.freedesktop.org/anholt/deqp-runner.git --tag v0.16.1
Get-Date
Write-Host "Downloading DirectX 12 Agility SDK"
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.Direct3D.D3D12/1.610.2 -OutFile 'agility.zip'
Expand-Archive -Path 'agility.zip' -DestinationPath 'C:\agility'
Remove-Item 'agility.zip'
$piglit_bin = 'C:\Piglit\bin'
$vk_cts_bin = "$deqp_build\external\vulkancts\modules\vulkan"
# Copy Agility SDK into subfolder of piglit and Vulkan CTS
$agility_dest = New-Item -ItemType Directory -Path $piglit_bin -Name 'D3D12'
Copy-Item 'C:\agility\build\native\bin\x64\*.dll' -Destination $agility_dest
$agility_dest = New-Item -ItemType Directory -Path $vk_cts_bin -Name 'D3D12'
Copy-Item 'C:\agility\build\native\bin\x64\*.dll' -Destination $agility_dest
Remove-Item -Recurse 'C:\agility'
Get-Date
Write-Host "Downloading Updated WARP"
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/1.0.7.1 -OutFile 'warp.zip'
Expand-Archive -Path 'warp.zip' -DestinationPath 'C:\warp'
Remove-Item 'warp.zip'
# Copy WARP next to piglit and Vulkan CTS
Copy-Item 'C:\warp\build\native\amd64\d3d10warp.dll' -Destination $piglit_bin
Copy-Item 'C:\warp\build\native\amd64\d3d10warp.dll' -Destination $vk_cts_bin
Remove-Item -Recurse 'C:\warp'
Get-Date
Write-Host "Downloading DirectXShaderCompiler release"
Invoke-WebRequest -Uri https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.7.2207/dxc_2022_07_18.zip -OutFile 'DXC.zip'
Expand-Archive -Path 'DXC.zip' -DestinationPath 'C:\DXC'
# No more need to get dxil.dll from the VS install
Copy-Item 'C:\DXC\bin\x64\*.dll' -Destination 'C:\Windows\System32'
Get-Date
Write-Host "Enabling developer mode"
# Create AppModelUnlock if it doesn't exist, required for enabling Developer Mode
$RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
if (-not(Test-Path -Path $RegistryKeyPath)) {
New-Item -Path $RegistryKeyPath -ItemType Directory -Force
}
# Add registry value to enable Developer Mode
New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1 -Force
Get-Date
Write-Host "Complete"

View File

@@ -0,0 +1,88 @@
# Compiling deqp
$ProgressPreference = "SilentlyContinue"
$MyPath = $MyInvocation.MyCommand.Path | Split-Path -Parent
. "$MyPath\mesa_init_msvc.ps1"
$source_dir = Join-Path -Path "$PWD" -ChildPath "src"
$deqp_source = Join-Path -Path "$source_dir" -ChildPath "VK-GL-CTS"
$deqp_build = Join-Path -Path "$PWD" -ChildPath "deqp"
Write-Host "Cloning Vulkan and GL Conformance Tests at:"
Get-Date
New-Item -ItemType Directory -Path "$deqp_source" | Out-Null
Push-Location -Path $deqp_source
git init
git remote add origin https://github.com/KhronosGroup/VK-GL-CTS.git
git fetch --depth 1 origin 56114106d860c121cd6ff0c3b926ddc50c4c11fd # of branch vulkan-cts-1.3.4
if (!$?) {
Write-Host "Failed to fetch deqp repository"
Pop-Location
Exit 1
}
git checkout FETCH_HEAD
Write-Host "Fetch sources inside $deqp_source at:"
Get-Date
# --insecure is due to SSL cert failures hitting sourceforge for zlib and
# libpng (sigh). The archives get their checksums checked anyway, and git
# always goes through ssh or https.
py .\external\fetch_sources.py --insecure
Pop-Location
Write-Host "Compiling deqp at:"
Get-Date
New-Item -ItemType Directory -Path "$deqp_build" | Out-Null
Push-Location -Path $deqp_build
cmake -S $($deqp_source) `
-B . `
-GNinja `
-DCMAKE_BUILD_TYPE=Release `
-DDEQP_TARGET=default && `
ninja -j32
if (!$?) {
Write-Host "Failed to compile deqp"
Pop-Location
Exit 1
}
Pop-Location
# Copy test result templates
Copy-Item -Path "$($deqp_source)\doc\testlog-stylesheet\testlog.css" -Destination $deqp_build
Copy-Item -Path "$($deqp_source)\doc\testlog-stylesheet\testlog.xsl" -Destination $deqp_build
# Copy Vulkan must-pass list
$deqp_mustpass = New-Item -ItemType Directory -Path $deqp_build -Name "mustpass"
$root_mustpass = Join-Path -Path $deqp_source -ChildPath "external\vulkancts\mustpass\main"
$files = Get-Content "$($root_mustpass)\vk-default.txt"
foreach($file in $files) {
Get-Content "$($root_mustpass)\$($file)" | Add-Content -Path "$($deqp_mustpass)\vk-main.txt"
}
Write-Host "Installing deqp-runner at:"
Get-Date
$env:Path += ";$($env:USERPROFILE)\.cargo\bin"
cargo install --git https://gitlab.freedesktop.org/anholt/deqp-runner.git --tag v0.16.1
$depsInstallPath="C:\mesa-deps"
$vk_cts_bin = "$deqp_build\external\vulkancts\modules\vulkan"
# Hard link Agility SDK into subfolder of Vulkan CTS
$agility_dest = New-Item -ItemType Directory -Path $vk_cts_bin -Name 'D3D12'
New-Item -ItemType HardLink -path $agility_dest\D3D12Core.dll -Value $depsInstallPath\bin\D3D12\D3D12Core.dll
New-Item -ItemType HardLink -path $agility_dest\d3d12SDKLayers.dll -Value $depsInstallPath\bin\D3D12\d3d12SDKLayers.dll
# Hard link WARP next to Vulkan CTS
New-Item -ItemType HardLink -path $vk_cts_bin\d3d10warp.dll -Value $depsInstallPath\bin\d3d10warp.dll
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path "$source_dir" | Out-Null
# Cleanup deqp intermediate files
Get-ChildItem -Force -ErrorAction SilentlyContinue -Recurse "$deqp_build" | Where-Object {
if($_.FullName -match "CMake|.git|.lib"){
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path $_.FullName | Out-Null
}
}
Write-Host "Compiling deqp finished at:"
Get-Date

View File

@@ -0,0 +1,103 @@
# Compiling Piglit
$ProgressPreference = "SilentlyContinue"
$MyPath = $MyInvocation.MyCommand.Path | Split-Path -Parent
. "$MyPath\mesa_init_msvc.ps1"
$source_dir = Join-Path -Path "$PWD" -ChildPath "src"
$waffle_source = Join-Path -Path "$source_dir" -ChildPath "waffle"
$waffle_install = Join-Path -Path "$PWD" -ChildPath "waffle"
$piglit_source = Join-Path -Path "$PWD" -ChildPath "Piglit"
Write-Host "Cloning Waffle at:"
Get-Date
New-Item -ItemType Directory -Path "$waffle_source" | Out-Null
Push-Location -Path $waffle_source
git init
git remote add origin https://gitlab.freedesktop.org/mesa/waffle.git
git fetch --depth 1 origin 950a1f35a718bc2a8e1dda75845e52651bb331a7 # of branch master
if (!$?) {
Write-Host "Failed to fetch Waffle repository"
Pop-Location
Exit 1
}
git checkout FETCH_HEAD
Pop-Location
Write-Host "Compiling Waffle at:"
Get-Date
$waffle_build = Join-Path -Path "$source_dir" -ChildPath "waffle\build"
New-Item -ItemType Directory -Path "$waffle_build" | Out-Null
Push-Location -Path $waffle_build
meson setup `
--buildtype=release `
--default-library=static `
--prefix="$waffle_install" && `
ninja -j32 install
if (!$?) {
Write-Host "Failed to compile or install Waffle"
Pop-Location
Exit 1
}
Pop-Location
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path "$waffle_build" | Out-Null
Write-Host "Downloading glext.h at:"
Get-Date
New-Item -ItemType Directory -Path "$source_dir\glext\GL" | Out-Null
Invoke-WebRequest -Uri 'https://github.com/KhronosGroup/OpenGL-Registry/raw/main/api/GL/glext.h' -OutFile "$source_dir\glext\GL\glext.h" | Out-Null
Write-Host "Cloning Piglit at:"
Get-Date
New-Item -ItemType Directory -Path "$piglit_source" | Out-Null
Push-Location -Path $piglit_source
git init
git remote add origin https://gitlab.freedesktop.org/mesa/piglit.git
git fetch --depth 1 origin b41accc83689966f91217fc5b57dbe06202b8c8c # of branch main
if (!$?) {
Write-Host "Failed to fetch Piglit repository"
Pop-Location
Exit 1
}
git checkout FETCH_HEAD
Write-Host "Compiling Piglit at:"
Get-Date
cmake -S . -B . `
-GNinja `
-DCMAKE_BUILD_TYPE=Release `
-DPIGLIT_USE_WAFFLE=ON `
-DWaffle_INCLUDE_DIRS="$waffle_install\include\waffle-1" `
-DWaffle_LDFLAGS="$waffle_install\lib\libwaffle-1.a" `
-DGLEXT_INCLUDE_DIR="$source_dir\glext" && `
ninja -j32
if (!$?) {
Write-Host "Failed to compile Piglit"
Pop-Location
Exit 1
}
Pop-Location
$depsInstallPath="C:\mesa-deps"
$piglit_bin = "$piglit_source\bin"
# Hard link Agility SDK into subfolder of piglit
$agility_dest = New-Item -ItemType Directory -Path $piglit_bin -Name 'D3D12'
New-Item -ItemType HardLink -path $agility_dest\D3D12Core.dll -Value $depsInstallPath\bin\D3D12\D3D12Core.dll
New-Item -ItemType HardLink -path $agility_dest\d3d12SDKLayers.dll -Value $depsInstallPath\bin\D3D12\d3d12SDKLayers.dll
# Hard link WARP next to piglit
New-Item -ItemType HardLink -path $piglit_bin\d3d10warp.dll -Value $depsInstallPath\bin\d3d10warp.dll
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path "$source_dir" | Out-Null
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path "$waffle_install" | Out-Null
# Cleanup piglit intermediate files
Get-ChildItem -Force -ErrorAction SilentlyContinue -Recurse "$piglit_source" | Where-Object {
if($_.FullName -match "CMake|.git|.lib"){
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path $_.FullName | Out-Null
}
}
Write-Host "Compiling Piglit finished at:"
Get-Date