2022-08-23 14:29:21 +00:00
|
|
|
$env:ErrorActionPreference='Stop'
|
|
|
|
|
2022-09-12 12:17:17 +00:00
|
|
|
[string[]] $exclude_crates = @(
|
2022-09-10 08:21:37 +00:00
|
|
|
"--exclude",
|
|
|
|
"gst-plugin-csound",
|
|
|
|
"--exclude",
|
|
|
|
"gst-plugin-webp"
|
2022-08-23 14:29:21 +00:00
|
|
|
)
|
|
|
|
|
2022-09-12 12:17:17 +00:00
|
|
|
[string[]] $features_matrix = @(
|
|
|
|
"--no-default-features",
|
|
|
|
"",
|
|
|
|
"--all-features"
|
|
|
|
)
|
2022-08-23 14:29:21 +00:00
|
|
|
|
2024-10-02 22:28:30 +00:00
|
|
|
if ($env:FDO_CI_CONCURRENT)
|
|
|
|
{
|
|
|
|
$ncpus = $env:FDO_CI_CONCURRENT
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$ncpus = (Get-WmiObject -Class Win32_ComputerSystem).NumberOfLogicalProcessors
|
|
|
|
}
|
|
|
|
Write-Host "Build Jobs: $ncpus"
|
|
|
|
$cargo_opts = @("--color=always", "--jobs=$ncpus", "--all-targets")
|
|
|
|
|
2022-09-12 12:17:17 +00:00
|
|
|
function Run-Tests {
|
|
|
|
param (
|
|
|
|
$Features
|
|
|
|
)
|
2021-10-19 06:45:07 +00:00
|
|
|
$local_exclude = $exclude_crates;
|
|
|
|
|
|
|
|
# In this case the plugin will pull x11/wayland features
|
|
|
|
# which will fail to build on windows.
|
|
|
|
if (($Features -eq '--all-features') -or ($Features -eq '')) {
|
|
|
|
$local_exclude += @("--exclude", "gst-plugin-gtk4")
|
|
|
|
}
|
2022-08-23 14:29:21 +00:00
|
|
|
|
2022-09-12 12:17:17 +00:00
|
|
|
Write-Host "Features: $Features"
|
2021-10-19 06:45:07 +00:00
|
|
|
Write-Host "Exclude string: $local_exclude"
|
2022-09-12 12:17:17 +00:00
|
|
|
|
2024-10-02 22:28:30 +00:00
|
|
|
cargo build $cargo_opts --workspace $local_exclude $Features
|
2022-08-23 14:29:21 +00:00
|
|
|
|
2022-09-12 12:17:17 +00:00
|
|
|
if (!$?) {
|
|
|
|
Write-Host "Build failed"
|
|
|
|
Exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
$env:G_DEBUG="fatal_warnings"
|
2024-06-06 11:45:59 +00:00
|
|
|
$env:RUST_BACKTRACE="1"
|
2024-10-02 22:28:30 +00:00
|
|
|
cargo nextest run $cargo_opts --profile=ci --no-fail-fast --workspace $local_exclude $Features
|
2022-09-12 12:17:17 +00:00
|
|
|
if (!$?) {
|
|
|
|
Write-Host "Tests failed"
|
|
|
|
Exit 1
|
|
|
|
}
|
2024-08-20 17:55:18 +00:00
|
|
|
|
|
|
|
Move-Junit -Features $Features
|
|
|
|
}
|
|
|
|
|
|
|
|
function Move-Junit {
|
|
|
|
param (
|
|
|
|
$Features
|
|
|
|
)
|
|
|
|
|
|
|
|
if ($env:CI_PROJECT_DIR) {
|
|
|
|
$parent = $env:CI_PROJECT_DIR
|
|
|
|
} else {
|
|
|
|
$parent = $PWD.path
|
|
|
|
}
|
|
|
|
Write-Host "Parent directory: $parent"
|
|
|
|
|
|
|
|
$new_report_dir = "$parent/junit_reports/"
|
|
|
|
If(!(test-path -PathType container $new_report_dir))
|
|
|
|
{
|
|
|
|
New-Item -Path "$new_report_dir" -ItemType "directory"
|
|
|
|
if (!$?) {
|
|
|
|
Write-Host "Failed to create directory: $new_report_dir"
|
|
|
|
Exit 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($Features -eq "--all-features") {
|
|
|
|
$suffix = "all"
|
|
|
|
} elseif ($Features -eq "--no-default-features") {
|
|
|
|
$suffix = "no-default"
|
|
|
|
} else {
|
|
|
|
$suffix = "default"
|
|
|
|
}
|
|
|
|
|
|
|
|
Move-Item "$parent/target/nextest/ci/junit.xml" "$new_report_dir/junit-$suffix.xml"
|
|
|
|
if (!$?) {
|
|
|
|
Write-Host "Failed to move junit file"
|
|
|
|
Exit 1
|
|
|
|
}
|
2022-09-12 12:17:17 +00:00
|
|
|
}
|
2022-08-23 14:29:21 +00:00
|
|
|
|
2022-09-12 12:17:17 +00:00
|
|
|
foreach($feature in $features_matrix) {
|
|
|
|
Run-Tests -Features $feature
|
2022-08-23 14:29:21 +00:00
|
|
|
}
|