From de3972a707715aa0b8b9003722d357940f79fb3f Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Tue, 23 Aug 2022 17:29:21 +0300 Subject: [PATCH] ci: Add visual studio/msvc builds Part-of: --- .gitlab-ci.yml | 40 +++++++++++++++++++++++ ci/run_windows_tests.ps1 | 69 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 ci/run_windows_tests.ps1 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7bedbb1e..e3246dcd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,6 +10,10 @@ include: variables: FDO_UPSTREAM_REPO: gstreamer/gst-plugins-rs + WINDOWS_BASE: "registry.freedesktop.org/gstreamer/gstreamer-rs/windows" + WINDOWS_RUST_MINIMUM_IMAGE: "$WINDOWS_BASE:$GST_RS_IMG_TAG-main-$GST_RS_MSRV" + WINDOWS_RUST_STABLE_IMAGE: "$WINDOWS_BASE:$GST_RS_IMG_TAG-main-$GST_RS_STABLE" + workflow: rules: - if: $CI_MERGE_REQUEST_IID @@ -256,6 +260,42 @@ gst-build: - 'build/meson-logs/' - 'build-gst-full/meson-logs/' +.msvc2019 build: + stage: 'test' + tags: + - 'docker' + - 'windows' + - '2022' + parallel: + matrix: + - FEATURES: + - "--no-default-features" + - "--all-features" + - "" + script: + - echo $env:FEATURES + + # Set the code page to UTF-8 + - chcp 65001 + + # We need to build each crate separately to choose that can build on windows + - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && + powershell ./ci/run_windows_tests.ps1" + + - | + if (!$?) { + Write-Host "Tests Failed!" + Exit 1 + } + +test windows msrv: + extends: '.msvc2019 build' + image: $WINDOWS_RUST_MINIMUM_IMAGE + +test windows stable: + extends: '.msvc2019 build' + image: "$WINDOWS_RUST_STABLE_IMAGE" + rustfmt: extends: .img-stable stage: "lint" diff --git a/ci/run_windows_tests.ps1 b/ci/run_windows_tests.ps1 new file mode 100644 index 00000000..fbeb2de5 --- /dev/null +++ b/ci/run_windows_tests.ps1 @@ -0,0 +1,69 @@ +$env:ErrorActionPreference='Stop' + +# List of all the crates we want to build +# We need to do this manually to avoid trying +# to build the ones which can't work on windows +[string[]] $crates = @( + # Same as default-members in Cargo.toml + "tutorial", + "version-helper", + "audio/audiofx", + "audio/claxon", + "audio/lewton", + "generic/file", + "generic/fmp4", + "generic/threadshare", + "net/onvif", + "net/raptorq", + "net/reqwest", + "net/aws", + "utils/fallbackswitch", + "utils/togglerecord", + "utils/tracers", + "utils/uriplaylistbin", + "video/cdg", + "video/ffv1", + "video/flavors", + "video/gif", + "video/rav1e", + "video/rspng", + "video/hsv", + "text/ahead", + "text/wrap", + "text/json", + "text/regex", + + # Extra crates that can be built + # "audio/csound", + "audio/spotify", + "generic/sodium", + "net/hlssink3", + "video/closedcaption", + "video/dav1d", + "video/gtk4", + "video/videofx" + # "video/webp", +) + +foreach($crate in $crates) +{ + Write-Host "Building crate: $crate" + Write-Host "Features: $env:FEATURES" + $env:LocalFeatures = $env:FEATURES + + 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 + } + + $env:G_DEBUG="fatal_warnings" + cargo test --no-fail-fast --color=always --manifest-path $crate/Cargo.toml --all-targets $env:LocalFeatures + + if (!$?) { + Write-Host "Tests failed to for crate: $crate" + Exit 1 + } +}