mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 17:44:01 -07:00
improve error handling in new scripts
This commit is contained in:
parent
b635ca367d
commit
52dc9a9fdf
2 changed files with 28 additions and 14 deletions
|
|
@ -1,27 +1,40 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# We cache thinned versions of universal ("fat") Qt binaries to reduce the size of the packages and caches.
|
# This script is used to resolve the latest patch version of Qt using aqtinstall.
|
||||||
# The universal binaries are install via aqtinstall. We use wildcards to get the latest patch version. E.g. "6.6.*" -> "6.6.3".
|
# It interprets wildcards to get the latest patch version. E.g. "6.6.*" -> "6.6.3".
|
||||||
# This script is used to resolve the latest patch version of Qt.
|
|
||||||
|
|
||||||
# This script is meant to be used by the ci enironment on macos runners only.
|
# This script is meant to be used by the ci enironment.
|
||||||
# It uses the runner's GITHUB_OUTPUT env variable.
|
# It uses the runner's GITHUB_OUTPUT env variable.
|
||||||
|
|
||||||
# Usage example: .ci/resolve_latest_aqt_qt_version.sh "6.6.*"
|
# Usage example: .ci/resolve_latest_aqt_qt_version.sh "6.6.*"
|
||||||
QT_SPEC=$1
|
|
||||||
|
qt_spec=$1
|
||||||
|
if [[ ! $qt_spec ]]; then
|
||||||
|
echo "usage: $0 [version]"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
# If version is already specific (no wildcard), use it as-is
|
# If version is already specific (no wildcard), use it as-is
|
||||||
if [[ "$QT_SPEC" != *"*" ]]; then
|
if [[ $qt_spec != *"*" ]]; then
|
||||||
echo "version=$QT_SPEC" >> "$GITHUB_OUTPUT"
|
echo "version $qt_spec is already resolved"
|
||||||
|
echo "version=$qt_spec" >> "$GITHUB_OUTPUT"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! hash aqt; then
|
||||||
|
echo "aqt could not be found, has aqtinstall been installed?"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
# Resolve latest patch
|
# Resolve latest patch
|
||||||
QT_RESOLVED=$(aqt list-qt mac desktop --spec "$QT_SPEC" --latest-version)
|
if ! qt_resolved=$(aqt list-qt mac desktop --spec "$qt_spec" --latest-version); then
|
||||||
echo "QT_RESOLVED=$QT_RESOLVED"
|
|
||||||
if [ -z "$QT_RESOLVED" ]; then
|
|
||||||
echo "Error: Could not resolve Qt version for $QT_SPEC"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "version=$QT_RESOLVED" >> "$GITHUB_OUTPUT"
|
echo "resolved $qt_spec to $qt_resolved"
|
||||||
|
if [[ ! $qt_resolved ]]; then
|
||||||
|
echo "Error: Could not resolve Qt version for $qt_spec"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "version=$qt_resolved" >> "$GITHUB_OUTPUT"
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ function thin() {
|
||||||
}
|
}
|
||||||
export -f thin # export to allow use in xargs
|
export -f thin # export to allow use in xargs
|
||||||
export arch
|
export arch
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
echo "::group::Thinning Qt libraries to $arch using $nproc cores"
|
echo "::group::Thinning Qt libraries to $arch using $nproc cores"
|
||||||
find "$GITHUB_WORKSPACE/Qt" -type f -print0 | xargs -0 -n1 -P"$nproc" -I{} bash -c "thin '{}'"
|
find "$GITHUB_WORKSPACE/Qt" -type f -print0 | xargs -0 -n1 -P"$nproc" -I{} bash -c "thin '{}'"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue