mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-10-31 22:59:14 +00:00
ci: Fix pwsh scripts not exiting on error
We all know that external utilities returning a non-zero exit code do not terminate a powershell script. However, most do not know (and neither did I) that it is impossible to promote error exit codes to script-terminating errors with ErrorActionPreference. Explicitly check the return codes and Exit. https://github.com/MicrosoftDocs/PowerShell-Docs/issues/1583 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1368>
This commit is contained in:
parent
b5f4246445
commit
52c764b986
3 changed files with 25 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
|||
variables:
|
||||
GST_RS_IMG_TAG: "2023-12-19.1"
|
||||
GST_RS_IMG_TAG: "2023-12-19.2"
|
||||
GST_RS_STABLE: "1.74.1"
|
||||
GST_RS_MSRV: "1.70.0"
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
FROM "registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2023-07-17.0-main"
|
||||
|
||||
# Make sure any failure in PowerShell is fatal
|
||||
ENV ErrorActionPreference='Stop'
|
||||
SHELL ["powershell","-NoLogo", "-NonInteractive", "-Command"]
|
||||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
ARG DEFAULT_BRANCH="main"
|
||||
ARG RUST_VERSION="invalid"
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
|
||||
# Make sure powershell exits on errors
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# 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
|
||||
|
||||
|
@ -13,6 +15,10 @@ Move-Item C:/subprojects/* C:\gstreamer\subprojects
|
|||
# Update the subprojects cache
|
||||
Write-Output "Running meson subproject reset"
|
||||
meson subprojects update --reset
|
||||
if (!$?) {
|
||||
Write-Host "Failed to update gstreamer subprojects"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
$MESON_ARGS = @(`
|
||||
"--prefix=C:\gst-install", `
|
||||
|
@ -42,9 +48,24 @@ echo "subproject('gtk')" >> meson.build
|
|||
|
||||
Write-Output "Building gstreamer"
|
||||
meson setup --vsenv $MESON_ARGS _build
|
||||
if (!$?) {
|
||||
type "_build\meson-logs\meson-log.txt"
|
||||
Write-Host "Failed to run meson setup, see log above"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
Write-Output "Compiling gstreamer"
|
||||
meson compile -C _build
|
||||
if (!$?) {
|
||||
Write-Host "Failed to run meson compile"
|
||||
Exit 1
|
||||
}
|
||||
# meson install does a spurious rebuild sometimes that then fails
|
||||
meson install --no-rebuild -C _build
|
||||
if (!$?) {
|
||||
Write-Host "Failed to run meson install"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
cd c:\
|
||||
Remove-Item -LiteralPath "C:\gstreamer" -Force -Recurse
|
||||
|
|
Loading…
Reference in a new issue