mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2024-12-19 06:26:31 +00:00
ci: enable windows build
This commit is contained in:
parent
d1ccea7ea8
commit
9c83ff6123
8 changed files with 268 additions and 0 deletions
|
@ -2,6 +2,7 @@ include:
|
|||
- project: "freedesktop/ci-templates" # the project to include from
|
||||
ref: "34f4ade99434043f88e164933f570301fd18b125" # git ref of that project
|
||||
file: "/templates/fedora.yml" # the actual file to include
|
||||
- local: "ci/images_template.yml"
|
||||
|
||||
stages:
|
||||
- prepare
|
||||
|
@ -12,6 +13,8 @@ stages:
|
|||
variables:
|
||||
FDO_UPSTREAM_REPO: "dabrain34/GstPipelineStudio"
|
||||
GNOME_RUNTIME_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:41"
|
||||
WINDOWS_RUST_STABLE_IMAGE: "$CI_REGISTRY_IMAGE/windows:$GST_RS_IMG_TAG-main-$GST_RS_STABLE"
|
||||
WINDOWS_RUST_STABLE_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/windows:$GST_RS_IMG_TAG-main-$GST_RS_STABLE"
|
||||
|
||||
# Version and tag for our current container
|
||||
.fedora:
|
||||
|
@ -56,6 +59,62 @@ build-fedora-container:
|
|||
ci/install-rust.sh stable &&
|
||||
pip3 install meson
|
||||
|
||||
.windows rust docker build:
|
||||
stage: prepare
|
||||
variables:
|
||||
# Unlike the buildah/linux jobs, this file
|
||||
# needs to be relative to windows-docker/ subdir
|
||||
# as it makes life easier in the powershell script
|
||||
#
|
||||
# We also don't need a CONTEXT_DIR var as its also
|
||||
# hardcoded to be windows-docker/
|
||||
DOCKERFILE: 'ci/windows-docker/Dockerfile'
|
||||
GST_UPSTREAM_BRANCH: 'main'
|
||||
tags:
|
||||
- 'windows'
|
||||
- 'shell'
|
||||
- '2022'
|
||||
script:
|
||||
# We need to pass an array and to resolve the env vars, so we can't use a variable:
|
||||
- $DOCKER_BUILD_ARGS = @("--build-arg", "DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH", "--build-arg", "RUST_VERSION=$RUST_VERSION")
|
||||
|
||||
- "& ci/windows-docker/container.ps1 $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $RUST_IMAGE $RUST_UPSTREAM_IMAGE $DOCKERFILE"
|
||||
- |
|
||||
if (!($?)) {
|
||||
echo "Failed to build the image"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
windows rust docker stable:
|
||||
extends: '.windows rust docker build'
|
||||
variables:
|
||||
RUST_IMAGE: !reference [variables, "WINDOWS_RUST_STABLE_IMAGE"]
|
||||
RUST_UPSTREAM_IMAGE: !reference [variables, "WINDOWS_RUST_STABLE_UPSTREAM_IMAGE"]
|
||||
RUST_VERSION: !reference [variables, "GST_RS_STABLE"]
|
||||
|
||||
.msvc2019 build:
|
||||
stage: test
|
||||
tags:
|
||||
- 'docker'
|
||||
- 'windows'
|
||||
- '2022'
|
||||
script:
|
||||
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 &&
|
||||
powershell ./ci/run_windows.ps1"
|
||||
|
||||
- |
|
||||
if (!$?) {
|
||||
Write-Host "Tests Failed!"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
test windows stable:
|
||||
needs:
|
||||
- job: 'windows rust docker stable'
|
||||
artifacts: false
|
||||
image: "$WINDOWS_RUST_STABLE_IMAGE"
|
||||
extends: '.msvc2019 build'
|
||||
|
||||
rustfmt-clippy:
|
||||
extends:
|
||||
- .fedora
|
||||
|
|
4
ci/images_template.yml
Normal file
4
ci/images_template.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
variables:
|
||||
GST_RS_IMG_TAG: '2023-03-03.0'
|
||||
GST_RS_STABLE: '1.67.0'
|
||||
GST_RS_MSRV: '1.63.0'
|
2
ci/run_windows.ps1
Normal file
2
ci/run_windows.ps1
Normal file
|
@ -0,0 +1,2 @@
|
|||
meson buildddir
|
||||
ninja -C builddir
|
27
ci/windows-docker/Dockerfile
Normal file
27
ci/windows-docker/Dockerfile
Normal file
|
@ -0,0 +1,27 @@
|
|||
# escape=`
|
||||
|
||||
FROM "registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2022-09-23.0-main"
|
||||
|
||||
# Make sure any failure in PowerShell is fatal
|
||||
ENV ErrorActionPreference='Stop'
|
||||
SHELL ["powershell","-NoLogo", "-NonInteractive", "-Command"]
|
||||
|
||||
ARG DEFAULT_BRANCH="main"
|
||||
ARG RUST_VERSION="invalid"
|
||||
|
||||
RUN choco install -y pkgconfiglite nasm llvm
|
||||
|
||||
# https://stackoverflow.com/a/50716450
|
||||
RUN setx PATH '%PATH%;C:\Program Files\NASM;C:\gst-install\bin;c:\Program Files\gettext-iconv\bin'
|
||||
ENV PKG_CONFIG_PATH="C:\gst-install\lib\pkgconfig"
|
||||
|
||||
COPY install_pango.ps1 install_gst.ps1 install_gtk.ps1 C:\
|
||||
RUN C:\install_pango.ps1
|
||||
RUN C:\install_gst.ps1
|
||||
RUN C:\install_gtk.ps1
|
||||
|
||||
RUN Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile C:\rustup-init.exe
|
||||
RUN C:\rustup-init.exe -y --profile minimal --default-toolchain $env:RUST_VERSION
|
||||
|
||||
RUN Invoke-WebRequest -Uri https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.21-v1.16/gettext0.21-iconv1.16-shared-64.exe -OutFile C:\gettext0.21.exe
|
||||
RUN C:\gettext0.21.exe /SILENT
|
60
ci/windows-docker/container.ps1
Normal file
60
ci/windows-docker/container.ps1
Normal file
|
@ -0,0 +1,60 @@
|
|||
# Copied from mesa, big kudos
|
||||
#
|
||||
# https://gitlab.freedesktop.org/mesa/mesa/-/blob/master/.gitlab-ci/windows/mesa_container.ps1
|
||||
# https://gitlab.freedesktop.org/mesa/mesa/-/blob/34e3e164936d1d3cef267da7780e87f062fedf39/.gitlab-ci/windows/mesa_container.ps1
|
||||
|
||||
# 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]
|
||||
$dockerfile = $args[5]
|
||||
|
||||
docker --config "windows-docker.conf" 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 --config "windows-docker.conf" pull "$registry_user_image"
|
||||
if ($?) {
|
||||
Write-Host "User image $registry_user_image already exists; not rebuilding"
|
||||
docker --config "windows-docker.conf" logout "$registry_uri"
|
||||
Exit 0
|
||||
}
|
||||
|
||||
# if the image already exists upstream, copy it
|
||||
docker --config "windows-docker.conf" pull "$registry_central_image"
|
||||
if ($?) {
|
||||
Write-Host "Copying central image $registry_central_image to user image $registry_user_image"
|
||||
docker --config "windows-docker.conf" tag "$registry_central_image" "$registry_user_image"
|
||||
docker --config "windows-docker.conf" push "$registry_user_image"
|
||||
$pushstatus = $?
|
||||
docker --config "windows-docker.conf" 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 --config "windows-docker.conf" build $DOCKER_BUILD_ARGS --no-cache -t "$registry_user_image" -f "$dockerfile" "./ci/windows-docker"
|
||||
if (!$?) {
|
||||
Write-Host "Container build failed"
|
||||
docker --config "windows-docker.conf" logout "$registry_uri"
|
||||
Exit 1
|
||||
}
|
||||
Get-Date
|
||||
|
||||
docker --config "windows-docker.conf" push "$registry_user_image"
|
||||
$pushstatus = $?
|
||||
docker --config "windows-docker.conf" logout "$registry_uri"
|
||||
if (!$pushstatus) {
|
||||
Write-Host "Pushing image to $registry_user_image failed"
|
||||
Exit 1
|
||||
}
|
62
ci/windows-docker/install_gst.ps1
Normal file
62
ci/windows-docker/install_gst.ps1
Normal file
|
@ -0,0 +1,62 @@
|
|||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
|
||||
|
||||
# Download gstreamer and all its subprojects
|
||||
git clone -b $env:DEFAULT_BRANCH --depth 1 https://gitlab.freedesktop.org/gstreamer/gstreamer.git C:\gstreamer
|
||||
if (!$?) {
|
||||
Write-Host "Failed to clone gstreamer"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
Set-Location C:\gstreamer
|
||||
|
||||
# Copy the cache we already have in the image to avoid massive redownloads
|
||||
Move-Item C:/subprojects/* C:\gstreamer\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
|
||||
}
|
||||
|
||||
$env:MESON_ARGS = "--prefix=C:\gst-install\ " +
|
||||
"-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 " +
|
||||
"-Dgpl=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
|
||||
}
|
||||
|
||||
cd C:\
|
||||
cmd /c rmdir /s /q C:\gstreamer
|
||||
if (!$?) {
|
||||
Write-Host "Failed to remove gst checkout"
|
||||
Exit 1
|
||||
}
|
27
ci/windows-docker/install_gtk.ps1
Normal file
27
ci/windows-docker/install_gtk.ps1
Normal file
|
@ -0,0 +1,27 @@
|
|||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
|
||||
|
||||
$env:MESON_ARGS = "--prefix=C:\gst-install\"
|
||||
|
||||
# Download gtk and all its subprojects
|
||||
git clone -b 4.8.2 --depth 1 https://gitlab.gnome.org/gnome/gtk.git C:\gtk
|
||||
if (!$?) {
|
||||
Write-Host "Failed to clone gtk"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
Set-Location C:\gtk
|
||||
|
||||
Write-Output "Building gtk"
|
||||
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 gtk"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
cd C:\
|
||||
cmd /c rmdir /s /q C:\gtk
|
||||
if (!$?) {
|
||||
Write-Host "Failed to remove gtk checkout"
|
||||
Exit 1
|
||||
}
|
27
ci/windows-docker/install_pango.ps1
Normal file
27
ci/windows-docker/install_pango.ps1
Normal file
|
@ -0,0 +1,27 @@
|
|||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
|
||||
|
||||
$env:MESON_ARGS = "--prefix=C:\gst-install\ --wrap-mode=forcefallback"
|
||||
|
||||
# Download pango all its subprojects
|
||||
git clone -b 1.50.14 --depth 1 https://gitlab.gnome.org/gnome/pango.git C:\pango
|
||||
if (!$?) {
|
||||
Write-Host "Failed to clone pango"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
Set-Location C:\pango
|
||||
|
||||
Write-Output "Building pango"
|
||||
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 pango"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
cd C:\
|
||||
cmd /c rmdir /s /q C:\pango
|
||||
if (!$?) {
|
||||
Write-Host "Failed to remove gtk checkout"
|
||||
Exit 1
|
||||
}
|
Loading…
Reference in a new issue