docker-php-extension-installer/scripts/test-installcomposer

31 lines
1.0 KiB
Plaintext
Raw Normal View History

2020-12-16 11:34:30 +01:00
#!/bin/sh
# Let's set a sane environment
set -o errexit
set -o nounset
WANTED_VERSION="${1:-}"
INSTALLME=@composer
if test -n "$WANTED_VERSION"; then
2021-08-11 11:43:38 +02:00
INSTALLME="$INSTALLME-$1"
2020-12-16 11:34:30 +01:00
fi
2021-01-14 17:05:23 +01:00
CI=true ./install-php-extensions "$INSTALLME"
2020-12-16 11:34:30 +01:00
INSTALLED_VERSION="$(composer --version | sed -E 's/^.*[Vv]ersion\s*(\S+).*$/\1/')"
if test -z "$WANTED_VERSION"; then
2021-08-11 11:43:38 +02:00
echo 'Installing the latest version worked'
2020-12-16 11:34:30 +01:00
elif printf '%s' "$WANTED_VERSION" | grep -Eq '^[0-9]+$'; then
2021-08-11 11:43:38 +02:00
if test "${INSTALLED_VERSION#$WANTED_VERSION.}" = "$INSTALLED_VERSION"; then
printf 'Installing major version %s DID NOT worked (we installed version %s)\n' "$WANTED_VERSION" "$INSTALLED_VERSION"
exit 1
fi
printf 'Installing major version %s worked (we installed version %s)\n' "$WANTED_VERSION" "$INSTALLED_VERSION"
2020-12-16 11:34:30 +01:00
else
2021-08-11 11:43:38 +02:00
if test "$INSTALLED_VERSION" != "$WANTED_VERSION"; then
printf 'Installing specific version %s DID NOT worked (we installed version %s)\n' "$WANTED_VERSION" "$INSTALLED_VERSION"
exit 1
fi
printf 'Installing specific version %s worked\n' "$INSTALLED_VERSION"
2020-12-16 11:34:30 +01:00
fi