Skip to content

Commit

Permalink
Test against available php modules
Browse files Browse the repository at this point in the history
  • Loading branch information
cytopia committed Dec 27, 2018
1 parent b37afe3 commit bfbf9ea
Show file tree
Hide file tree
Showing 8 changed files with 196 additions and 25 deletions.
8 changes: 8 additions & 0 deletions .tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ PROJECT = vhost-tests
VHOST = $(PROJECT).loc


# -------------------------------------------------------------------------------------------------
# Misc Targets
# -------------------------------------------------------------------------------------------------
update-readme:
cat "../README.md" \
| perl -00 -pe "s/<!-- modules -->.*<!-- \/modules -->/<!-- modules -->\n$$(./get-modules.sh)\n<!-- \/modules -->/s" \
> "../README.md"

# -------------------------------------------------------------------------------------------------
# Testing Targets
# -------------------------------------------------------------------------------------------------
Expand Down
77 changes: 77 additions & 0 deletions .tests/get-modules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env bash

# Get PHP modules
PHP52="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/master/README.md | tac | tac | grep -E '52-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"
PHP53="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/master/README.md | tac | tac | grep -E '53-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"
PHP54="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/master/README.md | tac | tac | grep -E '54-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"
PHP55="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/master/README.md | tac | tac | grep -E '55-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"
PHP56="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/master/README.md | tac | tac | grep -E '56-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"
PHP70="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/master/README.md | tac | tac | grep -E '70-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"
PHP71="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/master/README.md | tac | tac | grep -E '71-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"
PHP72="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/master/README.md | tac | tac | grep -E '72-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"
PHP73="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/master/README.md | tac | tac | grep -E '73-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"
PHP74="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/master/README.md | tac | tac | grep -E '74-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"


ALL="$( echo "${PHP52}, ${PHP53}, ${PHP54}, ${PHP55}, ${PHP56}, ${PHP70}, ${PHP71}, ${PHP72}, ${PHP73}, ${PHP74}" | sed 's/,/\n/g' | sed -e 's/^\s*//g' -e 's/\s*$//g' | sort -u )"

Y=""

echo "| Modules | PHP 5.2 | PHP 5.3 | PHP 5.4 | PHP 5.5 | PHP 5.6 | PHP 7.0 | PHP 7.1 | PHP 7.2 | PHP 7.3 | PHP 7.4 |"
echo "|----------------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|"
echo "${ALL}" | while read line; do
printf "| %-15s%s" "${line}" "|"

if echo ",${PHP52}," | sed 's/,\s/,/g' | grep -Eq ",${line},"; then
printf " %s |" "${Y}"
else
printf " |"
fi
if echo ",${PHP53}," | sed 's/,\s/,/g' | grep -Eq ",${line},"; then
printf " %s |" "${Y}"
else
printf " |"
fi
if echo ",${PHP54}," | sed 's/,\s/,/g' | grep -Eq ",${line},"; then
printf " %s |" "${Y}"
else
printf " |"
fi
if echo ",${PHP55}," | sed 's/,\s/,/g' | grep -Eq ",${line},"; then
printf " %s |" "${Y}"
else
printf " |"
fi
if echo ",${PHP56}," | sed 's/,\s/,/g' | grep -Eq ",${line},"; then
printf " %s |" "${Y}"
else
printf " |"
fi
if echo ",${PHP70}," | sed 's/,\s/,/g' | grep -Eq ",${line},"; then
printf " %s |" "${Y}"
else
printf " |"
fi
if echo ",${PHP71}," | sed 's/,\s/,/g' | grep -Eq ",${line},"; then
printf " %s |" "${Y}"
else
printf " |"
fi
if echo ",${PHP72}," | sed 's/,\s/,/g' | grep -Eq ",${line},"; then
printf " %s |" "${Y}"
else
printf " |"
fi
if echo ",${PHP73}," | sed 's/,\s/,/g' | grep -Eq ",${line},"; then
printf " %s |" "${Y}"
else
printf " |"
fi
if echo ",${PHP74}," | sed 's/,\s/,/g' | grep -Eq ",${line},"; then
printf " %s |" "${Y}"
else
printf " |"
fi

printf "\n"
done
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ services:
### Specify combinations
###
env:
###
### Check PHP Modules
###
- S1=MODULES

###
### Check Documentation
###
Expand Down Expand Up @@ -196,7 +201,7 @@ env:
###
install:
# Update Debian/Ubuntu package index
- if [ "${S1}" != "DOCUMENTATION" ] && [ "${S1}" != "UPDATE" ]; then
- if [ "${S1}" != "MODULES" ] && [ "${S1}" != "DOCUMENTATION" ] && [ "${S1}" != "UPDATE" ]; then
until sudo apt-get update -qq; do sleep 5; done
fi

Expand Down Expand Up @@ -227,7 +232,7 @@ install:
echo "${COMPOSE_VERSION}";

# Install Docker and Docker Compose
- if [ "${S1}" != "DOCUMENTATION" ] && [ "${S1}" != "UPDATE" ]; then
- if [ "${S1}" != "MODULES" ] && [ "${S1}" != "DOCUMENTATION" ] && [ "${S1}" != "UPDATE" ]; then
until sudo apt-get -y -qq -o Dpkg::Options::="--force-confnew" install docker-ce${DOCKER_APT}; do sleep 5; done;
until curl -L -sS https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose; do sleep 5; done;
chmod +x docker-compose;
Expand Down Expand Up @@ -270,7 +275,11 @@ before_script:
### Test
###
script:
- if [ "${S1}" = "DOCUMENTATION" ]; then
- if [ "${S1}" = "MODULES" ]; then
cd .tests/;
make update-readme;
git diff --quiet || { echo "Build Changes"; git diff; git status; false; }
elif [ "${S1}" = "DOCUMENTATION" ]; then
cd docs/;
make build;
make linkcheck;
Expand Down
Loading

0 comments on commit bfbf9ea

Please sign in to comment.