The open source OpenXR runtime

ci: First pass for Windows CI

+644 -6
+86
.gitlab-ci.yml
··· 192 192 - .fdo.distribution-image@arch # from ci-templates 193 193 194 194 195 + # # # 196 + ### 197 + # Windows container-related jobs (prep and usage) 198 + 199 + .monado.common_variables.windows:vs2022: 200 + inherit: 201 + default: false 202 + variables: 203 + FDO_DISTRIBUTION_TAG: "20220518.0" 204 + MONADO_BASE_IMAGE_PATH: "win2019/vs2022_base" 205 + MONADO_MAIN_IMAGE_PATH: "win2019/vs2022" 206 + 207 + .monado.variables.windows:vs2022: 208 + inherit: 209 + default: false 210 + extends: 211 + - .monado.common_variables.windows:vs2022 212 + variables: 213 + MONADO_IMAGE_PATH: "$MONADO_MAIN_IMAGE_PATH" 214 + MONADO_IMAGE: "$CI_REGISTRY_IMAGE/$MONADO_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 215 + MONADO_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/$MONADO_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 216 + 217 + # Shared container-building job 218 + .monado.windows.container_prep: 219 + inherit: 220 + default: false 221 + tags: 222 + - windows 223 + - "1909" 224 + - shell 225 + variables: 226 + GIT_STRATEGY: fetch 227 + only: 228 + changes: 229 + - .gitlab-ci/**/* 230 + 231 + stage: container_prep 232 + script: 233 + - | 234 + .gitlab-ci\windows\monado_container.ps1 -RegistryUri "$CI_REGISTRY" -RegistryUsername "$CI_REGISTRY_USER" -UserImage "$MONADO_IMAGE" -UpstreamImage "$MONADO_UPSTREAM_IMAGE" -Dockerfile "$DOCKERFILE" -BaseImage "$MONADO_BASE_IMAGE" -BaseUpstreamImage "$MONADO_UPSTREAM_BASE_IMAGE" -Verbose 235 + 236 + # This container just installs Visual C++ Build Tools. 237 + win:container_prep:base: 238 + extends: 239 + - .monado.windows.container_prep 240 + - .monado.common_variables.windows:vs2022 241 + variables: 242 + DOCKERFILE: Dockerfile.vs2022 243 + MONADO_IMAGE_PATH: ${MONADO_BASE_IMAGE_PATH} 244 + MONADO_IMAGE: "$CI_REGISTRY_IMAGE/$MONADO_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 245 + MONADO_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/$MONADO_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 246 + 247 + # This container adds other deps 248 + win:container_prep: 249 + extends: 250 + - .monado.windows.container_prep 251 + - .monado.variables.windows:vs2022 252 + needs: 253 + - win:container_prep:base 254 + variables: 255 + DOCKERFILE: Dockerfile.build 256 + MONADO_BASE_IMAGE: "$CI_REGISTRY_IMAGE/$MONADO_BASE_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 257 + MONADO_UPSTREAM_BASE_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/$MONADO_BASE_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 258 + 259 + # Base job to use a Windows build container 260 + .monado.image.windows: 261 + tags: 262 + - windows 263 + - "1909" 264 + - docker 265 + extends: 266 + - .monado.variables.windows:vs2022 267 + image: $MONADO_IMAGE 268 + needs: 269 + - win:container_prep 195 270 # Style check job 196 271 format-and-spellcheck: 197 272 extends: ··· 388 463 - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt 389 464 - ninja -C build 390 465 - cd build && ctest --output-on-failure 466 + 467 + # Windows build 468 + windows: 469 + stage: build 470 + extends: 471 + - .monado.image.windows 472 + script: 473 + - ./.gitlab-ci/windows/monado_build.ps1 474 + artifacts: 475 + paths: 476 + - install 391 477 392 478 # Packaging 393 479 .monado.packaging.conditions:
.gitlab-ci/android_container_prep.sh
+12 -6
.gitlab-ci/ci-scripts.mk
··· 4 4 # To generate all the templated files, run this from the root of the repo: 5 5 # make -f .gitlab-ci/ci-scripts.mk 6 6 7 - # These also all have their template named the same with a .template suffix. 7 + # These also all have their template named the same with a .jinja suffix. 8 8 FILES_IN_SUBDIR := \ 9 9 .gitlab-ci/distributions \ 10 10 .gitlab-ci/reprepro.sh \ 11 11 12 12 CONFIG_FILE := .gitlab-ci/config.yml 13 - all: .gitlab-ci.yml $(FILES_IN_SUBDIR) 13 + OUTPUTS := .gitlab-ci.yml \ 14 + $(FILES_IN_SUBDIR) 15 + 16 + all: $(OUTPUTS) 17 + chmod +x .gitlab-ci/*.sh 14 18 .PHONY: all 15 19 16 20 clean: 17 - rm -f .gitlab-ci.yml $(FILES_IN_SUBDIR) 21 + rm -f $(OUTPUTS) 18 22 .PHONY: clean 23 + 24 + CI_FAIRY := ci-fairy generate-template --config=$(CONFIG_FILE) 19 25 20 26 # As the default thing for ci-fairy to template, this is special cased 21 - .gitlab-ci.yml: .gitlab-ci/ci.template $(CONFIG_FILE) 22 - ci-fairy generate-template 27 + .gitlab-ci.yml: .gitlab-ci/ci.template .gitlab-ci/win_containers.yml $(CONFIG_FILE) 28 + $(CI_FAIRY) $< > $@ 23 29 24 30 # Everything else is structured alike 25 31 $(FILES_IN_SUBDIR): %: %.jinja $(CONFIG_FILE) 26 - ci-fairy generate-template --config=$(CONFIG_FILE) $< > $@ 32 + $(CI_FAIRY) $< > $@
+13
.gitlab-ci/ci.template
··· 99 99 {% endfor -%} {%- endfor %} 100 100 {% endmacro -%} 101 101 102 + {% include 'win_containers.yml' %} 103 + 102 104 # Style check job 103 105 format-and-spellcheck: 104 106 extends: ··· 191 193 {%- endif %} 192 194 193 195 {% endfor -%} {%- endfor -%} {%- endfor %} 196 + 197 + # Windows build 198 + windows: 199 + stage: build 200 + extends: 201 + - .monado.image.windows 202 + script: 203 + - ./.gitlab-ci/windows/monado_build.ps1 204 + artifacts: 205 + paths: 206 + - install 194 207 195 208 # Packaging 196 209 .monado.packaging.conditions:
.gitlab-ci/i386_and_proclamation_container_prep.sh
.gitlab-ci/reprepro.sh
+78
.gitlab-ci/win_containers.yml
··· 1 + # {# included by ci.template #} 2 + # {# SPDX-License-Identifier: CC0-1.0 #} 3 + # {# SPDX-FileCopyrightText: 2018-2022 Collabora, Ltd. and the Monado contributors #} 4 + 5 + ### 6 + # Windows container-related jobs (prep and usage) 7 + 8 + .monado.common_variables.windows:vs2022: 9 + inherit: 10 + default: false 11 + variables: 12 + FDO_DISTRIBUTION_TAG: "20220518.0" 13 + MONADO_BASE_IMAGE_PATH: "win2019/vs2022_base" 14 + MONADO_MAIN_IMAGE_PATH: "win2019/vs2022" 15 + 16 + .monado.variables.windows:vs2022: 17 + inherit: 18 + default: false 19 + extends: 20 + - .monado.common_variables.windows:vs2022 21 + variables: 22 + MONADO_IMAGE_PATH: "$MONADO_MAIN_IMAGE_PATH" 23 + MONADO_IMAGE: "$CI_REGISTRY_IMAGE/$MONADO_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 24 + MONADO_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/$MONADO_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 25 + 26 + # Shared container-building job 27 + .monado.windows.container_prep: 28 + inherit: 29 + default: false 30 + tags: 31 + - windows 32 + - "1909" 33 + - shell 34 + variables: 35 + GIT_STRATEGY: fetch 36 + only: 37 + changes: 38 + - .gitlab-ci/**/* 39 + 40 + stage: container_prep 41 + script: 42 + - | 43 + .gitlab-ci\windows\monado_container.ps1 -RegistryUri "$CI_REGISTRY" -RegistryUsername "$CI_REGISTRY_USER" -UserImage "$MONADO_IMAGE" -UpstreamImage "$MONADO_UPSTREAM_IMAGE" -Dockerfile "$DOCKERFILE" -BaseImage "$MONADO_BASE_IMAGE" -BaseUpstreamImage "$MONADO_UPSTREAM_BASE_IMAGE" -Verbose 44 + 45 + # This container just installs Visual C++ Build Tools. 46 + win:container_prep:base: 47 + extends: 48 + - .monado.windows.container_prep 49 + - .monado.common_variables.windows:vs2022 50 + variables: 51 + DOCKERFILE: Dockerfile.vs2022 52 + MONADO_IMAGE_PATH: ${MONADO_BASE_IMAGE_PATH} 53 + MONADO_IMAGE: "$CI_REGISTRY_IMAGE/$MONADO_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 54 + MONADO_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/$MONADO_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 55 + 56 + # This container adds other deps 57 + win:container_prep: 58 + extends: 59 + - .monado.windows.container_prep 60 + - .monado.variables.windows:vs2022 61 + needs: 62 + - win:container_prep:base 63 + variables: 64 + DOCKERFILE: Dockerfile.build 65 + MONADO_BASE_IMAGE: "$CI_REGISTRY_IMAGE/$MONADO_BASE_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 66 + MONADO_UPSTREAM_BASE_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/$MONADO_BASE_IMAGE_PATH:$FDO_DISTRIBUTION_TAG" 67 + 68 + # Base job to use a Windows build container 69 + .monado.image.windows: 70 + tags: 71 + - windows 72 + - "1909" 73 + - docker 74 + extends: 75 + - .monado.variables.windows:vs2022 76 + image: $MONADO_IMAGE 77 + needs: 78 + - win:container_prep
+17
.gitlab-ci/windows/Dockerfile.build
··· 1 + # Copyright 2019-2022, Mesa contributors 2 + # Copyright 2022, Collabora, Ltd. 3 + # SPDX-License-Identifier: MIT 4 + # Based on https://gitlab.freedesktop.org/mesa/mesa/-/blob/8396df5ad90aeb6ab2267811aba2187954562f81/.gitlab-ci/windows/Dockerfile_build 5 + 6 + # escape=` 7 + 8 + ARG base_image 9 + FROM ${base_image} 10 + 11 + # Make sure any failure in PowerShell scripts is fatal 12 + SHELL ["powershell", "-ExecutionPolicy", "RemoteSigned", "-Command", "$ErrorActionPreference = 'Stop';"] 13 + ENV ErrorActionPreference='Stop' 14 + 15 + 16 + COPY "monado_deps_build.ps1" "C:/" 17 + RUN "C:/monado_deps_build.ps1"
+16
.gitlab-ci/windows/Dockerfile.vs2022
··· 1 + # Copyright 2019-2022, Mesa contributors 2 + # Copyright 2022, Collabora, Ltd. 3 + # SPDX-License-Identifier: MIT 4 + # Based on https://gitlab.freedesktop.org/mesa/mesa/-/blob/8396df5ad90aeb6ab2267811aba2187954562f81/.gitlab-ci/windows/Dockerfile_build 5 + 6 + # escape=` 7 + 8 + # FROM mcr.microsoft.com/windows:2004 9 + FROM mcr.microsoft.com/windows/servercore:ltsc2019 10 + 11 + # Make sure any failure in PowerShell scripts is fatal 12 + SHELL ["powershell", "-ExecutionPolicy", "RemoteSigned", "-Command", "$ErrorActionPreference = 'Stop';"] 13 + ENV ErrorActionPreference='Stop' 14 + 15 + COPY "monado_deps_vs2022.ps1" "C:/" 16 + RUN "C:/monado_deps_vs2022.ps1"
+70
.gitlab-ci/windows/README.md
··· 1 + # Native Windows GitLab CI builds 2 + 3 + <!-- 4 + # Copyright 2019-2022, Mesa contributors 5 + # Copyright 2022, Collabora, Ltd. 6 + # SPDX-License-Identifier: MIT 7 + 8 + Based on https://gitlab.freedesktop.org/mesa/mesa/-/blob/8396df5ad90aeb6ab2267811aba2187954562f81/.gitlab-ci/windows/README.md 9 + --> 10 + 11 + We are using the same basic approach to Windows CI building as Mesa, just as we 12 + do on Linux. See 13 + <https://gitlab.freedesktop.org/mesa/mesa/-/tree/main/.gitlab-ci/windows> for 14 + the details there. The following is the Mesa readme, lightly modified to fit 15 + Monado. 16 + 17 + Unlike Linux, Windows cannot reuse the freedesktop ci-templates as they exist 18 + as we do not have Podman, Skopeo, or even Docker-in-Docker builds available 19 + under Windows. 20 + 21 + We still reuse the same model: build a base container with the core operating 22 + system and infrequently-changed build dependencies, then execute Monado builds 23 + only inside that base container. This is open-coded in PowerShell scripts. 24 + 25 + ## Base container build 26 + 27 + The base container build jobs execute the `monado_container.ps1` script which 28 + reproduces the ci-templates behaviour. It looks for the registry image in 29 + the user's namespace, and exits if found. If not found, it tries to copy 30 + the same image tag from the upstream Monado repository. If that is not found, 31 + the image is rebuilt inside the user's namespace. 32 + 33 + The rebuild executes `docker build` which calls `monado_deps_*.ps1` inside the 34 + container to fetch and install all build dependencies. This includes Visual 35 + Studio Build Tools (downloaded from Microsoft, under the license which 36 + allows use by open-source projects), and other build tools from Scoop. 37 + (These are done as two separate jobs to allow "resuming from the middle".) 38 + 39 + This job is executed inside a Windows shell environment directly inside the 40 + host, without Docker. 41 + 42 + ## Monado build 43 + 44 + The Monado build runs inside the base container, executing `mesa_build.ps1`. 45 + This simply compiles Monado using CMake and Ninja, executing the build and 46 + unit tests. 47 + 48 + ## Local testing 49 + 50 + To try these scripts locally, you need this done once, rebooting after they are complete: 51 + 52 + ```pwsh 53 + scoop install sudo 54 + sudo Add-MpPreference -ExclusionProcess dockerd.exe 55 + sudo Add-MpPreference -ExclusionProcess docker.exe 56 + winget install stevedore 57 + sudo Add-MpPreference -ExclusionPath c:\ProgramData\docker 58 + ``` 59 + 60 + then this, done when you want to test: 61 + 62 + ```pwsh 63 + docker context use desktop-windows 64 + ``` 65 + 66 + before doing your normal `docker build .`, etc. (It may still be very slow 67 + despite the virus scanning exclusions.) 68 + 69 + If you're having issues accessing the network, see this comment's instructions: 70 + <https://github.com/docker/for-win/issues/9847#issuecomment-832674649>
+61
.gitlab-ci/windows/monado_build.ps1
··· 1 + # Copyright 2019-2022, Mesa contributors 2 + # Copyright 2022, Collabora, Ltd. 3 + # SPDX-License-Identifier: MIT 4 + # Based on https://gitlab.freedesktop.org/mesa/mesa/-/blob/8396df5ad90aeb6ab2267811aba2187954562f81/.gitlab-ci/windows/mesa_build.ps1 5 + 6 + # force the CA cert cache to be rebuilt, in case Meson tries to access anything 7 + Write-Host "Refreshing Windows TLS CA cache" 8 + (New-Object System.Net.WebClient).DownloadString("https://github.com") > $null 9 + 10 + $env:PYTHONUTF8 = 1 11 + 12 + Get-Date 13 + Write-Host "Compiling Monado" 14 + $sourcedir = (Resolve-Path "$PSScriptRoot/../..") 15 + $builddir = Join-Path $sourcedir "build" 16 + $installdir = Join-Path $sourcedir "install" 17 + $vcpkgdir = "c:\vcpkg" 18 + $toolchainfile = Join-Path $vcpkgdir "scripts/buildsystems/vcpkg.cmake" 19 + 20 + Remove-Item -Recurse -Force $installdir -ErrorAction SilentlyContinue 21 + 22 + Write-Output "builddir:$builddir" 23 + Write-Output "installdir:$installdir" 24 + Write-Output "sourcedir:$sourcedir" 25 + 26 + $installPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version 17 -property installationpath 27 + Write-Output "vswhere.exe installPath: $installPath" 28 + $installPath = "C:\BuildTools" 29 + Write-Output "Final installPath: $installPath" 30 + 31 + # Note that we can't have $ErrorActionPreference as "Stop" here: 32 + # it "errors" (not finding some shared tool because of our mini build tools install) 33 + # but the error doesn't matter for our use case. 34 + Import-Module (Join-Path $installPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll") 35 + Enter-VsDevShell -VsInstallPath $installPath -SkipAutomaticLocation -DevCmdArguments '-arch=x64 -no_logo -host_arch=amd64' 36 + 37 + Push-Location $sourcedir 38 + $cmakeArgs = @( 39 + "-S" 40 + "." 41 + "-B" 42 + "$builddir" 43 + "-GNinja" 44 + "-DCMAKE_BUILD_TYPE=RelWithDebInfo" 45 + "-DCMAKE_TOOLCHAIN_FILE=$toolchainfile" 46 + "-DCMAKE_INSTALL_PREFIX=$installdir" 47 + ) 48 + cmake @cmakeArgs 49 + 50 + ninja -C $builddir 51 + ninja -C $builddir install test 52 + 53 + $buildstatus = $? 54 + Pop-Location 55 + 56 + Get-Date 57 + 58 + if (!$buildstatus) { 59 + Write-Host "Monado build or test failed" 60 + Exit 1 61 + }
+197
.gitlab-ci/windows/monado_container.ps1
··· 1 + # Copyright 2019-2022, Mesa contributors 2 + # Copyright 2022, Collabora, Ltd. 3 + # SPDX-License-Identifier: MIT 4 + # Based on https://gitlab.freedesktop.org/mesa/mesa/-/blob/8396df5ad90aeb6ab2267811aba2187954562f81/.gitlab-ci/windows/mesa_container.ps1 5 + 6 + # Implements the equivalent of ci-templates container-ifnot-exists, using 7 + # Docker directly as we don't have buildah/podman/skopeo available under 8 + # Windows, nor can we execute Docker-in-Docker 9 + [CmdletBinding()] 10 + param ( 11 + # Address for container registry 12 + [Parameter()] 13 + [string] 14 + $RegistryUri, 15 + 16 + # Username for container registry 17 + [Parameter()] 18 + [ValidateNotNullOrEmpty()] 19 + [string] 20 + $RegistryUsername, 21 + 22 + # The path of the image for this user's fork 23 + [Parameter()] 24 + [ValidateNotNullOrEmpty()] 25 + [string] 26 + $UserImage, 27 + 28 + # The path of the image in the upstream registry 29 + [Parameter()] 30 + [string] 31 + $UpstreamImage, 32 + 33 + # Dockerfile to build 34 + [Parameter()] 35 + [string] 36 + $Dockerfile = "Dockerfile", 37 + 38 + # Base image to use for this container, if any 39 + [Parameter()] 40 + [string] 41 + $BaseImage, 42 + 43 + # Base image to use for this container, from the upstream repo, if any 44 + [Parameter()] 45 + [string] 46 + $BaseUpstreamImage 47 + ) 48 + 49 + $RegistryPassword = "$env:CI_REGISTRY_PASSWORD" 50 + 51 + $CommonDockerArgs = @( 52 + "--config" 53 + "windows-docker.conf" 54 + ) 55 + 56 + $ErrorActionPreference = 'Stop' 57 + 58 + # Returns $true on a zero error code 59 + # If $AllowFailure is not set, throws on a nonzero exit code 60 + function Start-Docker { 61 + param ( 62 + # Should we just return the exit code on failure instead of throwing? 63 + [Parameter()] 64 + [switch] 65 + $AllowFailure = $false, 66 + 67 + # Should we try to log out before throwing in case of an error? 68 + [Parameter()] 69 + [switch] 70 + $LogoutOnFailure = $false, 71 + 72 + # What arguments should be passed to docker (besides the config) 73 + [Parameter(Mandatory = $true)] 74 + [string[]] 75 + $ArgumentList 76 + ) 77 + $DockerArgs = $CommonDockerArgs + $ArgumentList 78 + Write-Verbose ("Will run docker " + ($DockerArgs -join " ")) 79 + $proc = Start-Process -FilePath "docker" -ArgumentList $DockerArgs -NoNewWindow -PassThru -WorkingDirectory "$PSScriptRoot" -Wait 80 + 81 + if ($proc.ExitCode -eq 0) { 82 + Write-Verbose "Success!" 83 + return $true 84 + } 85 + if (!$AllowFailure) { 86 + Write-Error ($ArgumentList[0] + " failed") 87 + if ($LogoutOnFailure) { 88 + Write-Host "Logging out" 89 + Start-Process -FilePath "docker" -ArgumentList ($CommonDockerArgs + @("logout", "$RegistryUri")) ` 90 + -NoNewWindow -PassThru -WorkingDirectory "$PSScriptRoot" -Wait 91 + } 92 + throw ("docker " + $ArgumentList[0] + " invocation failed") 93 + } 94 + 95 + return $false 96 + } 97 + 98 + # Returns $true if the $Image exists (whether or not we had to copy $UpstreamImage) 99 + function Test-Image { 100 + param ( 101 + # Image to look for 102 + [Parameter(Mandatory = $true)] 103 + [ValidateNotNullOrEmpty()] 104 + [string] 105 + $Image, 106 + 107 + # Equivalent image from the upstream repo, if any 108 + [Parameter()] 109 + [string] 110 + $UpstreamImage 111 + ) 112 + 113 + # if the image already exists, great 114 + Write-Verbose "Looking for $Image" 115 + # $pullResult = Start-Docker -AllowFailure -ArgumentList ("pull", "$Image") 116 + docker @CommonDockerArgs pull "$Image" 117 + if ($?) { 118 + Write-Host "Image $UserImage exists" 119 + return $true 120 + } 121 + if (!$UpstreamImage) { 122 + Write-Host "Cannot find $Image" 123 + return $false 124 + } 125 + # if it's only upstream, copy it 126 + Write-Host "Cannot find $Image, looking for upstream $UpstreamImage" 127 + docker @CommonDockerArgs pull "$UpstreamImage" 128 + if ($?) { 129 + Write-Host "Found upstream image, copying image from upstream $UpstreamImage to user $Image" 130 + Start-Docker -LogoutOnFailure -ArgumentList ("tag", "$UpstreamImage", "$Image") 131 + Start-Docker -LogoutOnFailure -ArgumentList ("push", "$Image") 132 + return $true 133 + } 134 + Write-Host "Cannot find $Image nor $UpstreamImage" 135 + return $false 136 + } 137 + 138 + Write-Host "Will log in to $RegistryUri as $RegistryUsername" 139 + Write-Host "Will check for image $UserImage - if it does not exist but $UpstreamImage does, we copy that one, otherwise we need to build it." 140 + if ($BaseImage) { 141 + Write-Host "This image builds on $BaseImage so we will check for it." 142 + if ($BaseUpstreamImage) { 143 + Write-Host "If it is missing but $BaseUpstreamImage exists, we copy that one. If both are missing, we error out." 144 + } else { 145 + Write-Host "If it is missing, we error out." 146 + } 147 + } 148 + 149 + # Start-Docker -ArgumentList ("login", "-u", "$RegistryUsername", "--password-stdin", "$RegistryPassword", "$RegistryUri") 150 + $loginProc = Start-Process -FilePath "docker" -ArgumentList ($CommonDockerArgs + @("login", "-u", "$RegistryUsername", "--password", "$RegistryPassword", "$RegistryUri")) ` 151 + -NoNewWindow -PassThru -WorkingDirectory "$PSScriptRoot" -Wait 152 + if ($loginProc.ExitCode -ne 0) { 153 + throw "docker login failed" 154 + } 155 + 156 + # if the image already exists, don't rebuild it 157 + $imageResult = Test-Image -Image $UserImage -UpstreamImage $UpstreamImage 158 + if ($imageResult) { 159 + Write-Host "User image $UserImage already exists; not rebuilding" 160 + Start-Docker -ArgumentList ("logout", "$RegistryUri") 161 + Exit 0 162 + } 163 + 164 + 165 + # do we need a base image? 166 + if ($BaseImage) { 167 + $baseImageResult = Test-Image -Image "$BaseImage" -UpstreamImage "$BaseUpstreamImage" 168 + if (!$baseImageResult) { 169 + throw "Could not find base image: neither '$BaseImage' nor '$BaseUpstreamImage' exist." 170 + } 171 + } 172 + 173 + Write-Host "No image found at $UserImage or $UpstreamImage; rebuilding, this may take a while" 174 + $DockerBuildArgs = @( 175 + "build" 176 + "--no-cache" 177 + "-t" 178 + "$UserImage" 179 + "-f" 180 + "$Dockerfile" 181 + ) 182 + 183 + if ($BaseImage) { 184 + $DockerBuildArgs += @( 185 + "--build-arg" 186 + "base_image=$BaseImage" 187 + ) 188 + } 189 + 190 + $DockerBuildArgs += "." 191 + Start-Docker -LogoutOnFailure -ArgumentList (, $DockerBuildArgs) 192 + 193 + Get-Date 194 + 195 + Write-Host "Done building image, now pushing $UserImage" 196 + Start-Docker -LogoutOnFailure -ArgumentList ("push", "$UserImage") 197 + Start-Docker -ArgumentList ("logout", "$RegistryUri")
+51
.gitlab-ci/windows/monado_deps_build.ps1
··· 1 + # Copyright 2019-2022, Mesa contributors 2 + # Copyright 2022, Collabora, Ltd. 3 + # SPDX-License-Identifier: MIT 4 + # Based on https://gitlab.freedesktop.org/mesa/mesa/-/blob/8396df5ad90aeb6ab2267811aba2187954562f81/.gitlab-ci/windows/mesa_deps_build.ps1 5 + 6 + # Download new TLS certs from Windows Update 7 + Get-Date 8 + Write-Host "Updating TLS certificate store" 9 + $certdir = (New-Item -ItemType Directory -Name "_tlscerts") 10 + certutil -syncwithWU "$certdir" 11 + Foreach ($file in (Get-ChildItem -Path "$certdir\*" -Include "*.crt")) { 12 + Import-Certificate -FilePath $file -CertStoreLocation Cert:\LocalMachine\Root 13 + } 14 + Remove-Item -Recurse -Path $certdir 15 + 16 + Get-Date 17 + Write-Host "Installing runtime redistributables" 18 + Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.x64.exe" -OutFile "C:\vcredist_x64.exe" -UseBasicParsing 19 + Start-Process -NoNewWindow -Wait "C:\vcredist_x64.exe" -ArgumentList "/install /passive /norestart /log out.txt" 20 + if (!$?) { 21 + Write-Host "Failed to install vc_redist" 22 + Exit 1 23 + } 24 + Remove-Item "C:\vcredist_x64.exe" -Force 25 + 26 + Get-Date 27 + Write-Host "Installing Scoop" 28 + Set-ExecutionPolicy RemoteSigned -Scope CurrentUser 29 + Invoke-WebRequest get.scoop.sh -OutFile install.ps1 30 + .\install.ps1 -RunAsAdmin 31 + scoop install git 32 + 33 + Get-Date 34 + Write-Host "Installing things from Scoop" 35 + scoop install cmake 36 + scoop install python 37 + scoop install vulkan 38 + scoop install ninja 39 + 40 + Get-Date 41 + Write-Host "Preparing vcpkg" 42 + Set-Location C:\ 43 + git clone https://github.com/microsoft/vcpkg.git 44 + Set-Location vcpkg 45 + ./bootstrap-vcpkg.bat -DisableMetrics 46 + 47 + Get-Date 48 + Write-Host "Installing some base deps from vcpkg" 49 + ./vcpkg.exe install cjson:x64-windows eigen3:x64-windows wil:x64-windows pthreads:x64-windows glslang:x64-windows libusb:x64-windows hidapi:x64-windows 50 + Remove-Item -Recurse -Path downloads 51 + Remove-Item -Recurse -Path buildtrees
+43
.gitlab-ci/windows/monado_deps_vs2022.ps1
··· 1 + # Copyright 2019-2022, Mesa contributors 2 + # Copyright 2022, Collabora, Ltd. 3 + # SPDX-License-Identifier: MIT 4 + # Based on https://gitlab.freedesktop.org/mesa/mesa/-/blob/8396df5ad90aeb6ab2267811aba2187954562f81/.gitlab-ci/windows/mesa_deps_vs2019.ps1 5 + 6 + # we want more secure TLS 1.2 for most things 7 + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; 8 + 9 + # VS17.x is 2022 10 + $msvc_url = 'https://aka.ms/vs/17/release/vs_buildtools.exe' 11 + 12 + Get-Date 13 + Write-Host "Downloading Visual Studio 2022 build tools" 14 + Invoke-WebRequest -Uri $msvc_url -OutFile C:\vs_buildtools.exe -UseBasicParsing 15 + 16 + Get-Date 17 + Write-Host "Installing Visual Studio" 18 + $vsInstallerArgs = @( 19 + "--wait" 20 + "--quiet" 21 + "--norestart" 22 + "--nocache" 23 + "--installPath" 24 + "C:\BuildTools" 25 + "--add" 26 + "Microsoft.VisualStudio.Component.VC.CoreBuildTools" 27 + "--add" 28 + "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core" 29 + "--add" 30 + "Microsoft.VisualStudio.Component.Windows10SDK" 31 + "--add" 32 + "Microsoft.VisualStudio.Component.Windows11SDK.22000" 33 + "--add" 34 + "Component.Microsoft.Windows.CppWinRT" 35 + "--add" 36 + "Microsoft.VisualStudio.Component.VC.Tools.x86.x64" 37 + ) 38 + Start-Process -NoNewWindow -Wait C:\vs_buildtools.exe -ArgumentList $vsInstallerArgs 39 + if (!$?) { 40 + Write-Host "Failed to install Visual Studio tools" 41 + Exit 1 42 + } 43 + Remove-Item C:\vs_buildtools.exe -Force