7 echo "--------------------------------------"
8 echo "Checking for PHP styling (PSR2) issues"
9 echo "--------------------------------------"
10 composer global require "squizlabs/php_codesniffer=3.*" || failTest=true
11 $HOME/.config/composer/vendor/bin/phpcs -p -n --extensions=php,inc --report-width=120 --standard=ci/phpcs.xml --report=full . || failTest=true
18 echo "-----------------------------------------------"
19 jobTest="${mes} - Checking for PHP styling (PSR2) issues"
20 jobTests+="${jobTest}\n"
22 echo "-----------------------------------------------"
25 echo "------------------------------"
26 echo "Checking for PHP syntax errors"
27 echo "------------------------------"
29 if find . -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"; then failSyntax=true; fi
30 if find . -type f -name "*.inc" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"; then failSyntax=true; fi
40 echo "---------------------------------------"
41 jobTest="${mes} - Checking for PHP syntax errors"
42 jobTests+="${jobTest}\n"
44 echo "---------------------------------------"
45 - &dockers_env_start |
47 echo "---------------------------------------------------------------------"
48 echo "Start up the appropriate testing docker system to allow testing below"
49 echo "---------------------------------------------------------------------"
50 cd ci/${DOCKER_DIR} || failTest=true
51 docker-compose up -d || failTest=true
52 cd ../../ || failTest=true
59 echo "------------------------------------------------------------------------------"
60 jobTest="${mes} - Start up the appropriate testing docker system to allow testing below"
61 jobTests+="${jobTest}\n"
63 echo "------------------------------------------------------------------------------"
66 echo "------------------"
67 echo "Main OpenEMR Build"
68 echo "------------------"
69 composer install || failTest=true
70 npm install || failTest=true
71 npm run build || failTest=true
72 composer global require phing/phing || failTest=true
73 $HOME/.config/composer/vendor/bin/phing vendor-clean || failTest=true
74 $HOME/.config/composer/vendor/bin/phing assets-clean || failTest=true
75 composer global remove phing/phing || failTest=true
76 composer dump-autoload -o || failTest=true
77 rm -fr node_modules || failTest=true
84 echo "---------------------------"
85 jobTest="${mes} - Main OpenEMR Build"
86 jobTests+="${jobTest}\n"
88 echo "---------------------------"
91 echo "------------------"
92 echo "CCDA OpenEMR Build"
93 echo "------------------"
94 cd ccdaservice || failTest=true
95 npm install || failTest=true
96 cd ../ || failTest=true
103 echo "---------------------------"
104 jobTest="${mes} - CCDA OpenEMR Build"
105 jobTests+="${jobTest}\n"
107 echo "---------------------------"
108 - &install_configure |
110 echo "----------------------------------------------------------------------------------------------"
111 echo "Install and Configure OpenEMR for testing (remove registration modal on login and turn on api)"
112 echo "----------------------------------------------------------------------------------------------"
113 sudo chmod 666 sites/default/sqlconf.php || failTest=true
114 sudo chown -R www-data:www-data sites/default/documents || failTest=true
115 sed -e 's@^exit;@ @' < contrib/util/installScripts/InstallerAuto.php > contrib/util/installScripts/InstallerAutoTemp.php || failTest=true
116 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "php -f ${OPENEMR_DIR}/contrib/util/installScripts/InstallerAutoTemp.php rootpass=root server=mysql loginhost=%" || failTest=true
117 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "rm -f ${OPENEMR_DIR}/contrib/util/installScripts/InstallerAutoTemp.php" || failTest=true
118 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c 'mysql -u openemr --password="openemr" -h mysql -e "INSERT INTO product_registration (opt_out) VALUES (1)" openemr' || failTest=true
119 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c 'mysql -u openemr --password="openemr" -h mysql -e "UPDATE globals SET gl_value = 1 WHERE gl_name = \"rest_api\"" openemr' || failTest=true
126 echo "-------------------------------------------------------------------------------------------------------"
127 jobTest="${mes} - Install and Configure OpenEMR for testing (remove registration modal on login and turn on api)"
128 jobTests+="${jobTest}\n"
130 echo "-------------------------------------------------------------------------------------------------------"
133 echo "------------------"
134 echo "Dev Test OpenEMR Build"
135 echo "------------------"
136 composer require "phpunit/phpunit=8.*" || failTest=true
137 composer require "symfony/panther=^0.6" || failTest=true
138 composer dump-autoload -o || failTest=true
145 echo "-------------------------------"
146 jobTest="${mes} - Dev Test OpenEMR Build"
147 jobTests+="${jobTest}\n"
149 echo "-------------------------------"
152 echo "---------------"
153 echo "Run Unit Tests"
154 echo "---------------"
155 php vendor/bin/phpunit --testsuite unit --testdox || failTest=true
162 echo "-----------------------"
163 jobTest="${mes} - Run Unit Tests"
164 jobTests+="${jobTest}\n"
166 echo "-----------------------"
172 php vendor/bin/phpunit --testsuite e2e --testdox || failTest=true
179 echo "----------------------"
180 jobTest="${mes} - Run E2e Tests"
181 jobTests+="${jobTest}\n"
183 echo "----------------------"
189 php vendor/bin/phpunit --testsuite api --testdox || failTest=true
196 echo "----------------------"
197 jobTest="${mes} - Run Api Tests"
198 jobTests+="${jobTest}\n"
200 echo "----------------------"
201 - &job_summary_prep |
207 jobSummary="--------------------------------------------\n"
208 jobSummary+="--------------------------------------------\n"
209 jobSummary+="${mes} - JOB SUMMARY\n"
210 jobSummary+="--------------------------------------------\n"
211 jobSummary+="${jobTests}"
212 jobSummary+="--------------------------------------------"
214 - echo "extension=ldap.so" >>php --ini | grep "Loaded Configuration" | sed -e "s|.:\s||"``
216 - echo 'error_reporting = "E_ALL & ~E_NOTICE & ~E_STRICT"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
225 - echo -e "${jobSummary}"
226 - if $failJob; then travis_terminate 1; fi
227 - name: 'Syntax - PHP 7.2'
233 - echo -e "${jobSummary}"
234 - if $failJob; then travis_terminate 1; fi
235 - name: 'Syntax - PHP 7.3'
241 - echo -e "${jobSummary}"
242 - if $failJob; then travis_terminate 1; fi
243 - name: 'Syntax - PHP 7.4'
249 - echo -e "${jobSummary}"
250 - if $failJob; then travis_terminate 1; fi
251 - name: 'Syntax - PHP 8.0'
257 - echo -e "${jobSummary}"
258 - if $failJob; then travis_terminate 1; fi
259 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.4'
262 - DOCKER_DIR=apache_73_104
263 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
275 - echo -e "${jobSummary}"
276 - if $failJob; then travis_terminate 1; fi
277 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.3'
280 - DOCKER_DIR=apache_73_103
281 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
293 - echo -e "${jobSummary}"
294 - if $failJob; then travis_terminate 1; fi
295 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.2'
298 - DOCKER_DIR=apache_73_102
299 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
311 - echo -e "${jobSummary}"
312 - if $failJob; then travis_terminate 1; fi
313 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.1'
316 - DOCKER_DIR=apache_73_101
317 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
329 - echo -e "${jobSummary}"
330 - if $failJob; then travis_terminate 1; fi
331 - name: 'Build and test - PHP 7.3 - Apache - MySQL 8'
334 - DOCKER_DIR=apache_73_8
335 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
347 - echo -e "${jobSummary}"
348 - if $failJob; then travis_terminate 1; fi
349 - name: 'Build and test - PHP 7.3 - Apache - MySQL 5.7'
352 - DOCKER_DIR=apache_73_57
353 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
365 - echo -e "${jobSummary}"
366 - if $failJob; then travis_terminate 1; fi
367 - name: 'Build and test - PHP 7.3 - Apache - MySQL 5.6'
370 - DOCKER_DIR=apache_73_56
371 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
383 - echo -e "${jobSummary}"
384 - if $failJob; then travis_terminate 1; fi
385 - name: 'Build and test - PHP 7.2 - Nginx - MariaDB 10.4'
388 - DOCKER_DIR=nginx_72
389 - OPENEMR_DIR=/usr/share/nginx/html/openemr
401 - echo -e "${jobSummary}"
402 - if $failJob; then travis_terminate 1; fi
403 - name: 'Build and test - PHP 7.3 - Nginx - MariaDB 10.4'
406 - DOCKER_DIR=nginx_73
407 - OPENEMR_DIR=/usr/share/nginx/html/openemr
419 - echo -e "${jobSummary}"
420 - if $failJob; then travis_terminate 1; fi
421 - name: 'Build and test - PHP 7.4 - Nginx - MariaDB 10.4'
424 - DOCKER_DIR=nginx_74
425 - OPENEMR_DIR=/usr/share/nginx/html/openemr
437 - echo -e "${jobSummary}"
438 - if $failJob; then travis_terminate 1; fi
439 - name: 'Build and test (only phpunit; no functional tests) - PHP 8.0'
448 - echo -e "${jobSummary}"
449 - if $failJob; then travis_terminate 1; fi
451 - name: 'Build and test (only phpunit; no functional tests) - PHP 8.0'
452 - name: 'Syntax - PHP 8.0'