diff options
author | Erik Faye-Lund <erik.faye-lund@collabora.com> | 2020-08-18 11:26:17 +0200 |
---|---|---|
committer | Erik Faye-Lund <erik.faye-lund@collabora.com> | 2020-08-24 13:51:26 +0200 |
commit | e34bf55a62d9a814b642f2385a1baf38f70d9078 (patch) | |
tree | 1db4770993f2feb9d8e230ebbf8f09f5db5d8932 | |
parent | 66c8265b79c4ce5b6701263223189be2a6b812e8 (diff) |
gitlab-ci: add build-windows job
This is based on a mixture of what we do in Mesa, as well as what we do
for the corresponding Debian build here.
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/371>
-rw-r--r-- | .gitlab-ci.yml | 44 | ||||
-rw-r--r-- | .gitlab-ci/windows/container.ps1 | 56 |
2 files changed, 100 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c0eb6b3cd..9177aa864 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,9 @@ variables: DEBIAN_TAG: "2020-04-21" DEBIAN_VERSION: buster-slim DEBIAN_IMAGE: "$CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG" + WINDOWS_TAG: "2020-08-18" + WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/windows/x64_build:$WINDOWS_TAG" + WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$UPSTREAM_REPO/windows/x64_build:$WINDOWS_TAG" GIT_DEPTH: 100 include: @@ -55,6 +58,27 @@ debian: needs: [debian] image: $DEBIAN_IMAGE +windows: + stage: container + extends: + - .ci-run-policy + variables: + GIT_STRATEGY: fetch # we do actually need the full repository though + tags: + - windows + - shell + - "1809" + script: + - .\.gitlab-ci\windows\container.ps1 $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $WINDOWS_IMAGE $WINDOWS_UPSTREAM_IMAGE +.use-windows: + extends: + - .ci-run-policy + tags: + - windows + - docker + - "1809" + needs: [windows] + image: $WINDOWS_IMAGE # BUILD @@ -89,6 +113,26 @@ build-debian: -GNinja - ninja -j4 +build-windows: + stage: build + extends: + - .use-windows + script: + - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && + cmake . -D CMAKE_BUILD_TYPE=Debug + -D PIGLIT_BUILD_CL_TESTS=off + -D GLUT_INCLUDE_DIR=C:\freeglut\include + -D GLUT_glut_LIBRARY_RELEASE=C:\freeglut\lib\x64\freeglut.lib + -D GLEXT_INCLUDE_DIR=C:\glext\ + -D PIGLIT_BUILD_DMA_BUF_TESTS=off + -D PIGLIT_BUILD_GLES1_TESTS=off + -D PIGLIT_BUILD_GLES2_TESTS=off + -D PIGLIT_BUILD_GLX_TESTS=off + -D PIGLIT_BUILD_GL_TESTS=on + -D PIGLIT_BUILD_WGL_TESTS=on + -GNinja && + ninja -j4" + py.test: stage: build extends: diff --git a/.gitlab-ci/windows/container.ps1 b/.gitlab-ci/windows/container.ps1 new file mode 100644 index 000000000..c68845198 --- /dev/null +++ b/.gitlab-ci/windows/container.ps1 @@ -0,0 +1,56 @@ +# Implements the equivalent of ci-templates container-ifnot-exists, using +# Docker directly as we don't have buildah/podman/skopeo available under +# Windows, nor can we execute Docker-in-Docker +$registry_uri = $args[0] +$registry_username = $args[1] +$registry_password = $args[2] +$registry_user_image = $args[3] +$registry_central_image = $args[4] + +Set-Location -Path ".\.gitlab-ci\windows" + +docker login -u "$registry_username" -p "$registry_password" "$registry_uri" +if (!$?) { + Write-Host "docker login failed to $registry_uri" + Exit 1 +} + +# if the image already exists, don't rebuild it +docker pull "$registry_user_image" +if ($?) { + Write-Host "User image $registry_user_image already exists; not rebuilding" + docker logout "$registry_uri" + Exit 0 +} + +# if the image already exists upstream, copy it +docker pull "$registry_central_image" +if ($?) { + Write-Host "Copying central image $registry_central_image to user image $registry_user_image" + docker tag "$registry_central_image" "$registry_user_image" + docker push "$registry_user_image" + $pushstatus = $? + docker logout "$registry_uri" + if (!$pushstatus) { + Write-Host "Pushing image to $registry_user_image failed" + Exit 1 + } + Exit 0 +} + +Write-Host "No image found at $registry_user_image or $registry_central_image; rebuilding" +docker build --no-cache -t "$registry_user_image" . +if (!$?) { + Write-Host "Container build failed" + docker logout "$registry_uri" + Exit 1 +} +Get-Date + +docker push "$registry_user_image" +$pushstatus = $? +docker logout "$registry_uri" +if (!$pushstatus) { + Write-Host "Pushing image to $registry_user_image failed" + Exit 1 +} |