mirror of
https://github.com/danog/docker-php-extension-installer.git
synced 2024-12-02 17:38:21 +01:00
Merge pull request #370 from mlocati/ci-allow-filtering-phpversion
Make it easy to test only specific PHP versions
This commit is contained in:
commit
e870ee5743
2
.github/workflows/test-extensions.yml
vendored
2
.github/workflows/test-extensions.yml
vendored
@ -80,7 +80,7 @@ jobs:
|
|||||||
name: Check on ${{ matrix.distro }}
|
name: Check on ${{ matrix.distro }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
DOCKER_DISTRO: ${{ matrix.distro }}
|
IPETEST_DOCKER_DISTRO: ${{ matrix.distro }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
2
.github/workflows/test-recent-extensions.yml
vendored
2
.github/workflows/test-recent-extensions.yml
vendored
@ -49,7 +49,7 @@ jobs:
|
|||||||
- buster
|
- buster
|
||||||
name: Check on ${{ matrix.distro }}
|
name: Check on ${{ matrix.distro }}
|
||||||
env:
|
env:
|
||||||
DOCKER_DISTRO: ${{ matrix.distro }}
|
IPETEST_DOCKER_DISTRO: ${{ matrix.distro }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Global environment variables used:
|
||||||
|
# - IPETEST_DOCKER_DISTRO (required) the handle of the docker distibution to be used (eg 'buster', 'alpine3.14')
|
||||||
|
# - IPETEST_ONLY_PHPVERSIONS (optional) a space-separeted list of PHP versions: if set, we'll test only those PHP versions (eg '8.0 8.1')
|
||||||
|
|
||||||
# Let's set a sane environment
|
# Let's set a sane environment
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
@ -107,8 +111,8 @@ filterUnsupportedExensionsForDistro() {
|
|||||||
filterUnsupportedExensionsForDistro_filtered=''
|
filterUnsupportedExensionsForDistro_filtered=''
|
||||||
IFS=' '
|
IFS=' '
|
||||||
for filterUnsupportedExensionsForDistro_extension in $EXTENSIONS_TO_BE_TESTED; do
|
for filterUnsupportedExensionsForDistro_extension in $EXTENSIONS_TO_BE_TESTED; do
|
||||||
if stringInList "!$DOCKER_DISTRO" "$(cat "$filterUnsupportedExensionsForDistro_reqs" | grep -E "^$filterUnsupportedExensionsForDistro_extension[ \t]")"; then
|
if stringInList "!$IPETEST_DOCKER_DISTRO" "$(cat "$filterUnsupportedExensionsForDistro_reqs" | grep -E "^$filterUnsupportedExensionsForDistro_extension[ \t]")"; then
|
||||||
printf 'Note: extension "%s" is not supported for distro "%s"\n' "$filterUnsupportedExensionsForDistro_extension" "$DOCKER_DISTRO"
|
printf 'Note: extension "%s" is not supported for distro "%s"\n' "$filterUnsupportedExensionsForDistro_extension" "$IPETEST_DOCKER_DISTRO"
|
||||||
else
|
else
|
||||||
filterUnsupportedExensionsForDistro_filtered="$filterUnsupportedExensionsForDistro_filtered $filterUnsupportedExensionsForDistro_extension"
|
filterUnsupportedExensionsForDistro_filtered="$filterUnsupportedExensionsForDistro_filtered $filterUnsupportedExensionsForDistro_extension"
|
||||||
fi
|
fi
|
||||||
@ -126,7 +130,7 @@ filterUnsupportedExensionsForDistro() {
|
|||||||
# Outputs:
|
# Outputs:
|
||||||
# the full docker image ID (if exists/is usable)
|
# the full docker image ID (if exists/is usable)
|
||||||
getDockerImageName() {
|
getDockerImageName() {
|
||||||
if ! shouldProcessPhpVersionForDistro "$DOCKER_DISTRO" "$2"; then
|
if ! shouldProcessPhpVersionForDistro "$IPETEST_DOCKER_DISTRO" "$2"; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
case "$2" in
|
case "$2" in
|
||||||
@ -147,7 +151,7 @@ getDockerImageName() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
getDockerImageName_imageName="$(printf 'php:%s-%s-%s' "$getDockerImageName_version" "$getDockerImageName_suffix" "$DOCKER_DISTRO")"
|
getDockerImageName_imageName="$(printf 'php:%s-%s-%s' "$getDockerImageName_version" "$getDockerImageName_suffix" "$IPETEST_DOCKER_DISTRO")"
|
||||||
case "$getDockerImageName_imageName" in
|
case "$getDockerImageName_imageName" in
|
||||||
php:5.5-cli-jessie)
|
php:5.5-cli-jessie)
|
||||||
getDockerImageName_imageName='php:5.5-cli'
|
getDockerImageName_imageName='php:5.5-cli'
|
||||||
@ -240,8 +244,8 @@ getAllPHPVersionsForExtension() {
|
|||||||
if test -f "$filterUnsupportedExensionsForDistro_reqs"; then
|
if test -f "$filterUnsupportedExensionsForDistro_reqs"; then
|
||||||
getAllPHPVersionsForExtension_filtered_result=''
|
getAllPHPVersionsForExtension_filtered_result=''
|
||||||
for getAllPHPVersionsForExtension_result_filter in $getAllPHPVersionsForExtension_result; do
|
for getAllPHPVersionsForExtension_result_filter in $getAllPHPVersionsForExtension_result; do
|
||||||
if stringInList "!$getAllPHPVersionsForExtension_result_filter-$DOCKER_DISTRO" "$(cat "$filterUnsupportedExensionsForDistro_reqs" | grep -E "^$1[ \t]")"; then
|
if stringInList "!$getAllPHPVersionsForExtension_result_filter-$IPETEST_DOCKER_DISTRO" "$(cat "$filterUnsupportedExensionsForDistro_reqs" | grep -E "^$1[ \t]")"; then
|
||||||
printf 'Note: extension "%s" is not supported for distro "%s" using php "%s"\n' "$1" "$DOCKER_DISTRO" "$getAllPHPVersionsForExtension_result_filter" >/dev/stderr
|
printf 'Note: extension "%s" is not supported for distro "%s" using php "%s"\n' "$1" "$IPETEST_DOCKER_DISTRO" "$getAllPHPVersionsForExtension_result_filter" >/dev/stderr
|
||||||
else
|
else
|
||||||
getAllPHPVersionsForExtension_filtered_result="$getAllPHPVersionsForExtension_filtered_result $getAllPHPVersionsForExtension_result_filter"
|
getAllPHPVersionsForExtension_filtered_result="$getAllPHPVersionsForExtension_filtered_result $getAllPHPVersionsForExtension_result_filter"
|
||||||
fi
|
fi
|
||||||
@ -268,8 +272,10 @@ testExtension() {
|
|||||||
testExtension_extension="$(printf '%s' "$testExtension_extension" | sed -E 's/\+/ /g')"
|
testExtension_extension="$(printf '%s' "$testExtension_extension" | sed -E 's/\+/ /g')"
|
||||||
printf '### TESTING EXTENSION(S) %s ###\n' "$testExtension_extension"
|
printf '### TESTING EXTENSION(S) %s ###\n' "$testExtension_extension"
|
||||||
for testExtension_phpVersion in $(getAllPHPVersionsForExtensions "$testExtension_extension"); do
|
for testExtension_phpVersion in $(getAllPHPVersionsForExtensions "$testExtension_extension"); do
|
||||||
if ! testExtensionFor "$testExtension_extension" "$testExtension_phpVersion"; then
|
if test -z "${IPETEST_ONLY_PHPVERSIONS:-}" || stringInList "$testExtension_phpVersion" "$IPETEST_ONLY_PHPVERSIONS"; then
|
||||||
testExtensionsFromMessage_result=1
|
if ! testExtensionFor "$testExtension_extension" "$testExtension_phpVersion"; then
|
||||||
|
testExtensionsFromMessage_result=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@ -322,8 +328,8 @@ if test -z "${GITHUB_WORKSPACE:-}"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
CI_BUILD_DIR="$GITHUB_WORKSPACE"
|
CI_BUILD_DIR="$GITHUB_WORKSPACE"
|
||||||
if test -z "${DOCKER_DISTRO:-}"; then
|
if test -z "${IPETEST_DOCKER_DISTRO:-}"; then
|
||||||
echo 'DOCKER_DISTRO environment variable not set' >&2
|
echo 'IPETEST_DOCKER_DISTRO environment variable not set' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user