Revert "Revert "docker/windows: create a rust image for gst-rs""
authorJordan Petridis <jordan@centricular.com>
Wed, 8 Sep 2021 12:14:54 +0000 (15:14 +0300)
committerJordan Petridis <jordan@centricular.com>
Wed, 8 Sep 2021 12:14:54 +0000 (15:14 +0300)
This reverts commit b81620c3a75b6fff821e815c65b20f4fe36c677a.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-ci/-/merge_requests/414>

docker/windows/build_image.ps1
docker/windows/install_gst.ps1 [new file with mode: 0644]
docker/windows/rust.Dockerfile [new file with mode: 0644]
gitlab/ci_template.yml

index 95a60d8..37ffe02 100644 (file)
@@ -1,15 +1,28 @@
+$env:ErrorActionPreference='Stop'
+
 $env:DEFAULT_BRANCH='master'
 $env:VERSION='v18'
 $env:tag ="registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:$env:VERSION-$env:DEFAULT_BRANCH"
+$env:rust_tag ="registry.freedesktop.org/gstreamer/gst-ci/amd64/windows-rust:$env:VERSION-$env:DEFAULT_BRANCH"
+
+Set-Location './docker/windows/'
 
 Get-Date
 Write-Output "Building $env:tag"
-docker build --build-arg DEFAULT_BRANCH=$env:DEFAULT_BRANCH -f Dockerfile -t $env:tag .
+docker build --isolation=hyperv -m 12g --build-arg DEFAULT_BRANCH=$env:DEFAULT_BRANCH -f Dockerfile -t $env:tag .
 if (!$?) {
   Write-Host "Failed to build docker image $env:tag"
   Exit 1
 }
 
+Get-Date
+Write-Output "Building $env:rust_tag"
+docker build --isolation=hyperv -m 12g --build-arg DEFAULT_BRANCH=$env:DEFAULT_BRANCH -f rust.Dockerfile -t $env:rust_tag .
+if (!$?) {
+  Write-Host "Failed to build docker image $env:rust_tag"
+  Exit 1
+}
+
 # Get-Date
 # Write-Output "Pushing $env:tag"
 # docker push $env:tag
@@ -18,5 +31,14 @@ if (!$?) {
 #   Exit 1
 # }
 
+# Get-Date
+# Write-Output "Pushing $env:rust_tag"
+# docker push $env:rust_tag
+# if (!$?) {
+#   Write-Host "Failed to push docker image $env:rust_tag"
+#   Exit 1
+# }
+
+
 Get-Date
 Write-Output "Build Finished"
\ No newline at end of file
diff --git a/docker/windows/install_gst.ps1 b/docker/windows/install_gst.ps1
new file mode 100644 (file)
index 0000000..f000259
--- /dev/null
@@ -0,0 +1,76 @@
+[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
+
+# FIXME: Python fails to validate github.com SSL certificate, unless we first
+# run a dummy download to force refreshing Windows' CA database.
+# See: https://bugs.python.org/issue36137
+(New-Object System.Net.WebClient).DownloadString("https://github.com") >$null
+
+# Download gst-build and all its subprojects
+# git clone -b $env:DEFAULT_BRANCH https://gitlab.freedesktop.org/gstreamer/gst-build.git C:\gst-build
+# FIXME: need 1.19+ for cairo subproject :/
+# Should use a stable branch instead
+git clone -b master --depth 1 https://gitlab.freedesktop.org/gstreamer/gst-build.git C:\gst-build
+if (!$?) {
+  Write-Host "Failed to clone gst-build"
+  Exit 1
+}
+
+Set-Location C:\gst-build
+
+# Copy the cache we already have in the image to avoid massive redownloads
+Move-Item C:/subprojects/*  C:\gst-build\subprojects
+
+if (!$?) {
+  Write-Host "Failed to copy subprojects cache"
+  Exit 1
+}
+
+# Update the subprojects cache
+Write-Output "Running meson subproject reset"
+meson subprojects update --reset
+
+if (!$?) {
+  Write-Host "Failed to reset subprojects state"
+  Exit 1
+}
+
+Write-Output "Running git update"
+python git-update --no-interaction
+
+if (!$?) {
+  Write-Host "Failed to run git-update"
+  Exit 1
+}
+
+$env:MESON_ARGS = "-Dglib:installed_tests=false " +
+    "-Dlibnice:tests=disabled " +
+    "-Dlibnice:examples=disabled " +
+    "-Dffmpeg:tests=disabled " +
+    "-Dopenh264:tests=disabled " +
+    "-Dpygobject:tests=false " +
+    "-Dugly=enabled " +
+    "-Dbad=enabled " +
+    "-Dges=enabled " +
+    "-Drtsp_server=enabled " +
+    "-Ddevtools=enabled " +
+    "-Dsharp=disabled " +
+    "-Dpython=disabled " +
+    "-Dlibav=disabled " +
+    "-Dvaapi=disabled " +
+    "-Dgst-plugins-base:pango=enabled " +
+    "-Dgst-plugins-good:cairo=enabled "
+
+Write-Output "Building gst"
+cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && meson _build $env:MESON_ARGS && meson compile -C _build && ninja -C _build install"
+
+if (!$?) {
+  Write-Host "Failed to build and install gst"
+  Exit 1
+}
+
+git clean -fdxx
+
+if (!$?) {
+  Write-Host "Failed to git clean"
+  Exit 1
+}
\ No newline at end of file
diff --git a/docker/windows/rust.Dockerfile b/docker/windows/rust.Dockerfile
new file mode 100644 (file)
index 0000000..7ccfaff
--- /dev/null
@@ -0,0 +1,18 @@
+# escape=`
+
+FROM 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v16-master'
+
+ARG DEFAULT_BRANCH="master"
+ARG RUST_VERSION="1.52.1"
+
+COPY install_gst.ps1 C:\
+RUN C:\install_gst.ps1
+RUN choco install -y pkgconfiglite
+ENV PKG_CONFIG_PATH="C:/lib/pkgconfig"
+
+ADD https://win.rustup.rs/x86_64 C:\rustup-init.exe
+RUN C:\rustup-init.exe -y --profile minimal --default-toolchain $env:RUST_VERSION
+
+# Uncomment for easy testing
+# RUN git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
+# RUN cd gstreamer-rs; cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64; cargo build --all; cargo test --all"
\ No newline at end of file
index f2968b7..308af0e 100644 (file)
@@ -27,7 +27,7 @@ variables:
   MANIFEST_TAG: '2020-10-22.0'
   TEST_MANIFEST_TAG: '2020-10-22.0'
   INDENT_TAG: '2020-10-22.0'
-  WINDOWS_TAG: "2021-06-30.0"
+  WINDOWS_TAG: "2021-07-12.0"
 
   GST_UPSTREAM_REPO: 'gstreamer/gst-ci'