forked from mirrors/gstreamer-rs
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:
|
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_STABLE: "1.74.1"
|
||||||
GST_RS_MSRV: "1.70.0"
|
GST_RS_MSRV: "1.70.0"
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
FROM "registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2023-07-17.0-main"
|
FROM "registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2023-07-17.0-main"
|
||||||
|
|
||||||
# Make sure any failure in PowerShell is fatal
|
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||||
ENV ErrorActionPreference='Stop'
|
|
||||||
SHELL ["powershell","-NoLogo", "-NonInteractive", "-Command"]
|
|
||||||
|
|
||||||
ARG DEFAULT_BRANCH="main"
|
ARG DEFAULT_BRANCH="main"
|
||||||
ARG RUST_VERSION="invalid"
|
ARG RUST_VERSION="invalid"
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
|
||||||
# Make sure powershell exits on errors
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
# Download gstreamer and all its subprojects
|
# Download gstreamer and all its subprojects
|
||||||
git clone -b $env:DEFAULT_BRANCH --depth 1 https://gitlab.freedesktop.org/gstreamer/gstreamer.git C:\gstreamer
|
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
|
Set-Location C:\gstreamer
|
||||||
|
|
||||||
|
@ -13,6 +15,10 @@ Move-Item C:/subprojects/* C:\gstreamer\subprojects
|
||||||
# Update the subprojects cache
|
# Update the subprojects cache
|
||||||
Write-Output "Running meson subproject reset"
|
Write-Output "Running meson subproject reset"
|
||||||
meson subprojects update --reset
|
meson subprojects update --reset
|
||||||
|
if (!$?) {
|
||||||
|
Write-Host "Failed to update gstreamer subprojects"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
|
||||||
$MESON_ARGS = @(`
|
$MESON_ARGS = @(`
|
||||||
"--prefix=C:\gst-install", `
|
"--prefix=C:\gst-install", `
|
||||||
|
@ -42,9 +48,24 @@ echo "subproject('gtk')" >> meson.build
|
||||||
|
|
||||||
Write-Output "Building gstreamer"
|
Write-Output "Building gstreamer"
|
||||||
meson setup --vsenv $MESON_ARGS _build
|
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
|
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 does a spurious rebuild sometimes that then fails
|
||||||
meson install --no-rebuild -C _build
|
meson install --no-rebuild -C _build
|
||||||
|
if (!$?) {
|
||||||
|
Write-Host "Failed to run meson install"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
|
||||||
cd c:\
|
cd c:\
|
||||||
Remove-Item -LiteralPath "C:\gstreamer" -Force -Recurse
|
Remove-Item -LiteralPath "C:\gstreamer" -Force -Recurse
|
||||||
|
|
Loading…
Reference in a new issue