From d53dfcf94ea5a00cbd6c5b8bf66c9ed2274ed717 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Fri, 28 May 2021 06:02:25 +0300 Subject: [PATCH] ci: use a custom powershell script to run windows tests There are a couple things going on here. First, we need to avoid building egl/wayalnd/x11 crates on windows as they can't be built. Then we need to avoid running -sys tests as they don't succeed currently. See [1] Finally use a matrix:parallel job to tests multiple build configurations. [1] https://github.com/gtk-rs/gtk3-rs/issues/54 Part-of: --- .gitlab-ci.yml | 25 ++++++------ ci/run_windows_tests.ps1 | 85 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 11 deletions(-) create mode 100644 ci/run_windows_tests.ps1 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 30af5e21a..29d31f42c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -552,20 +552,23 @@ windows rust docker msrv: - 'docker' - 'windows' - '2022' + parallel: + matrix: + - FEATURES: + - "--features=v1_18," + - "--features=v1_20," + - "--features=v1_22," + - "--no-default-features" + - "" script: - - $env:Path += ';C:\bin\' + - echo $env:FEATURES + # Skip -sys tests as they don't work + # https://github.com/gtk-rs/gtk3-rs/issues/54 + # + # We need to build each crate separately to avoid crates like -egl,-wayland etc on windows - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && - cargo build --all && - cargo build --tests --all" - - | - if (!$?) { - Write-Host "Failed to build!" - Exit 1 - } - - - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && - cargo test --workspace --no-fail-fast -- --skip 'cross_validate_constants_with_c' --skip 'cross_validate_layout_with_c'" + powershell ./ci/run_windows_tests.ps1" - | if (!$?) { diff --git a/ci/run_windows_tests.ps1 b/ci/run_windows_tests.ps1 new file mode 100644 index 000000000..9b3cf9553 --- /dev/null +++ b/ci/run_windows_tests.ps1 @@ -0,0 +1,85 @@ +# Add the precompiled gst binaries to the path +$env:Path += ';C:\bin\' +$env:PKG_CONFIG_PATH = "C:/lib/pkgconfig" + +# List of all the crates we want to build +# We need to do this manually to avoid trying +# to build egl,wayland,x11 etc, which can't +# work on windows +[string[]] $crates = @( + 'gstreamer', + # Unix specific atm + # 'gstreamer-allocators' + 'gstreamer-app', + 'gstreamer-audio', + 'gstreamer-base', + 'gstreamer-check', + 'gstreamer-controller', + 'gstreamer-editing-services', + # 'gstreamer-gl', + # 'gstreamer-gl/egl', + # 'gstreamer-gl/wayland', + # 'gstreamer-gl/x11', + # only has sys + # 'gstreamer-mpegts', + 'gstreamer-mpegts/sys', + 'gstreamer-net', + 'gstreamer-pbutils', + 'gstreamer-player', + 'gstreamer-rtp', + 'gstreamer-rtsp', + 'gstreamer-rtsp-server', + 'gstreamer-sdp', + # only has sys + # 'gstreamer-tag', + 'gstreamer-tag/sys', + 'gstreamer-video', + 'gstreamer-webrtc', + 'tutorials', + 'examples' +) + +foreach($crate in $crates) +{ + Write-Host "Building crate: $crate" + Write-Host "Features: $env:FEATURES" + $env:LocalFeatures = $env:FEATURES + + # Don't append feature flags if the string is null/empty + # Or when we want to build without default features + if ($env:LocalFeatures -and ($env:LocalFeatures -ne '--no-default-features')) { + if ($crate -eq 'gstreamer') { + $env:LocalFeatures += "ser_de," + } + + if ($crate -eq 'examples') { + # FIXME: We can do --all-features for examples once we have gtk installed in the image + $env:LocalFeatures = "--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition" + } + + if ($crate -eq 'tutorials') { + $env:LocalFeatures = '' + } + } + + Write-Host "with features: $env:LocalFeatures" + cargo build --color=always --manifest-path $crate/Cargo.toml --all-targets $env:LocalFeatures + + if (!$?) { + Write-Host "Failed to build crate: $crate" + Exit 1 + } + + if (($crate -eq "gstreamer-tag/sys") -or ($crate -eq "gstreamer-mpegts/sys")) { + Write-Host "Skipping tests for $crate" + continue + } + + $env:G_DEBUG="fatal_warnings" + cargo test --no-fail-fast --color=always --manifest-path $crate/Cargo.toml $env:LocalFeatures + + if (!$?) { + Write-Host "Tests failed to for crate: $crate" + Exit 1 + } +} \ No newline at end of file