From 4f9b17c600f8ee772eeb047adfc469ec4b8ab705 Mon Sep 17 00:00:00 2001 From: Kevin Reed Date: Mon, 22 Oct 2018 14:44:05 -0500 Subject: [PATCH 1/6] Install php as part of the setup.sh script in order to support execution of the test cases --- setup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 9e49a77..89fff5d 100755 --- a/setup.sh +++ b/setup.sh @@ -5,8 +5,8 @@ echo "Attempting to install ansible, java and docker" #Check if using apt-get if [ -n "$(command -v apt-get)" ]; then - sudo apt-get -y -qq install ansible - sudo apt-get -y -qq install docker-ce + sudo apt -y -qq install ansible php php-xml php-mbstring + sudo apt -y -qq install docker-ce if [ $? -ne 0 ]; then echo "Please set up the repository for docker-ce. See https://docs.docker.com/engine/installation/linux/docker-ce/$(. /etc/os-release; echo "$ID")/" @@ -18,7 +18,7 @@ fi if [ -n "$(command -v yum)" ]; then sudo yum -y -q install epel-release - sudo yum -y -q install ansible docker composer + sudo yum -y -q install ansible docker composer php php-xml php-mbstring fi # Add user to docker group so that they can run docker commands From 56620d5f02e703312e3ec62cb9f7c3558b11de2d Mon Sep 17 00:00:00 2001 From: Kevin Reed Date: Tue, 23 Oct 2018 07:31:04 -0500 Subject: [PATCH 2/6] Check for apt since we are installing via apt instead of apt-get --- setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 89fff5d..6d9c0e9 100755 --- a/setup.sh +++ b/setup.sh @@ -2,8 +2,8 @@ echo "Attempting to install ansible, java and docker" -#Check if using apt-get -if [ -n "$(command -v apt-get)" ]; +#Check if using apt +if [ -n "$(command -v apt)" ]; then sudo apt -y -qq install ansible php php-xml php-mbstring sudo apt -y -qq install docker-ce From 50d5e54fbd7a0feaf30d82ec48333d9e61af30af Mon Sep 17 00:00:00 2001 From: Kevin Reed Date: Thu, 25 Oct 2018 13:25:21 -0500 Subject: [PATCH 3/6] Add zip and unzip to the install packages to support some of the composer installed packages --- setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 6d9c0e9..56338d5 100755 --- a/setup.sh +++ b/setup.sh @@ -5,7 +5,7 @@ echo "Attempting to install ansible, java and docker" #Check if using apt if [ -n "$(command -v apt)" ]; then - sudo apt -y -qq install ansible php php-xml php-mbstring + sudo apt -y -qq install ansible php php-xml php-mbstring zip unzip sudo apt -y -qq install docker-ce if [ $? -ne 0 ]; then @@ -18,7 +18,7 @@ fi if [ -n "$(command -v yum)" ]; then sudo yum -y -q install epel-release - sudo yum -y -q install ansible docker composer php php-xml php-mbstring + sudo yum -y -q install ansible docker composer php php-xml php-mbstring zip unzip fi # Add user to docker group so that they can run docker commands From 6cbe05e531caa562e85330314f85908827a76df4 Mon Sep 17 00:00:00 2001 From: Kevin Reed Date: Tue, 23 Apr 2019 09:31:17 -0500 Subject: [PATCH 4/6] Properly install PHP 7.3 on Linux. Automate installation of composer on Debian --- setup | 6 ------ setup.sh | 39 +++++++++++++++++++++++++++++++++------ tests/composer.json | 2 +- 3 files changed, 34 insertions(+), 13 deletions(-) delete mode 100755 setup diff --git a/setup b/setup deleted file mode 100755 index 5b4b1a8..0000000 --- a/setup +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -composer require phpunit/phpunit -composer require guzzlehttp/guzzle -composer update -composer test \ No newline at end of file diff --git a/setup.sh b/setup.sh index 56338d5..e336e68 100755 --- a/setup.sh +++ b/setup.sh @@ -1,6 +1,31 @@ #!/bin/bash -echo "Attempting to install ansible, java and docker" +echo "Attempting to install ansible, java, docker, php and composer" + +#This function comes from https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md +install_composer() { + EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)" + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" + + if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ] + then + >&2 echo 'ERROR: Invalid installer signature' + rm composer-setup.php + exit 1 + fi + + sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer + RESULT=$? + rm composer-setup.php + if [ $RESULT -ne 0 ]; + then + echo "Failed to install composer. Return code: $RESULT" + exit 1 + else + echo "Composer installed successfully" + fi +} #Check if using apt if [ -n "$(command -v apt)" ]; @@ -18,6 +43,9 @@ fi if [ -n "$(command -v yum)" ]; then sudo yum -y -q install epel-release + sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm + sudo yum-config-manager --enable remi-php73 + sudo yum -y -q clean all sudo yum -y -q install ansible docker composer php php-xml php-mbstring zip unzip fi @@ -43,17 +71,16 @@ fi # Check if composer is installed. If it isn't, direct user to instructions if [ -z "$(command -v composer)" ]; then - echo "Please download and install composer. See https://getcomposer.org/download/" - exit 1 + install_composer() fi sudo systemctl enable docker sudo systemctl restart docker cd tests -composer require phpunit/phpunit -composer require guzzlehttp/guzzle -composer update +composer -q require phpunit/phpunit +composer -q require guzzlehttp/guzzle +composer -q update cd .. echo "Setup complete." diff --git a/tests/composer.json b/tests/composer.json index d258a51..f645644 100644 --- a/tests/composer.json +++ b/tests/composer.json @@ -1,6 +1,6 @@ { "require": { - "phpunit/phpunit": "^7.2", + "phpunit/phpunit": "^8.1", "guzzlehttp/guzzle": "^6.3" }, From 7ea36b5838301845016a90500c3467d9c8e1652a Mon Sep 17 00:00:00 2001 From: Kevin Reed Date: Tue, 23 Apr 2019 09:38:59 -0500 Subject: [PATCH 5/6] Fix bad bash function call syntax. Reduce logging for yum installation --- setup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index e336e68..c7da7cd 100755 --- a/setup.sh +++ b/setup.sh @@ -43,8 +43,8 @@ fi if [ -n "$(command -v yum)" ]; then sudo yum -y -q install epel-release - sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm - sudo yum-config-manager --enable remi-php73 + sudo yum -y -q install http://rpms.remirepo.net/enterprise/remi-release-7.rpm + sudo yum-config-manager -y -q --enable remi-php73 sudo yum -y -q clean all sudo yum -y -q install ansible docker composer php php-xml php-mbstring zip unzip fi @@ -71,7 +71,7 @@ fi # Check if composer is installed. If it isn't, direct user to instructions if [ -z "$(command -v composer)" ]; then - install_composer() + install_composer fi sudo systemctl enable docker From 9de6a9567bf9e727fdbfed31d4aa977c12d99b01 Mon Sep 17 00:00:00 2001 From: Kevin Reed Date: Tue, 23 Apr 2019 09:50:44 -0500 Subject: [PATCH 6/6] Fix composer installation so that it uses what is specified in the composer.json file instead of simply grabbing the latest --- setup.sh | 3 +-- tests/composer.json | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index c7da7cd..acccff4 100755 --- a/setup.sh +++ b/setup.sh @@ -78,8 +78,7 @@ sudo systemctl enable docker sudo systemctl restart docker cd tests -composer -q require phpunit/phpunit -composer -q require guzzlehttp/guzzle +composer -q install composer -q update cd .. diff --git a/tests/composer.json b/tests/composer.json index f645644..d258a51 100644 --- a/tests/composer.json +++ b/tests/composer.json @@ -1,6 +1,6 @@ { "require": { - "phpunit/phpunit": "^8.1", + "phpunit/phpunit": "^7.2", "guzzlehttp/guzzle": "^6.3" },