5 - &composer_github_auth |
6 githubTokenRateLimitRequest=`curl -H "Authorization: token 310659f0a8658693af9ccb9da8969584b598910a" https://api.github.com/rate_limit`
7 githubTokenRateLimit=`echo $githubTokenRateLimitRequest | jq '.rate.remaining'`
8 echo "Number of github api requests remaining is $githubTokenRateLimit"
9 if [ "$githubTokenRateLimit" -gt 500 ]; then
10 echo "Using composer github api token"
11 composer config --global --auth github-oauth.github.com 310659f0a8658693af9ccb9da8969584b598910a
13 echo "Not using composer github api token"
17 echo "--------------------------------------"
18 echo "Checking for PHP styling (PSR2) issues"
19 echo "--------------------------------------"
20 composer global require "squizlabs/php_codesniffer=3.*" || failTest=true
21 $HOME/.config/composer/vendor/bin/phpcs -p -n --extensions=php,inc --report-width=120 --standard=ci/phpcs.xml --report=full . || failTest=true
28 echo "-----------------------------------------------"
29 jobTest="${mes} - Checking for PHP styling (PSR2) issues"
30 jobTests+="${jobTest}\n"
32 echo "-----------------------------------------------"
35 echo "------------------------------"
36 echo "Checking for PHP syntax errors"
37 echo "------------------------------"
39 if find . -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"; then failSyntax=true; fi
40 if find . -type f -name "*.inc" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"; then failSyntax=true; fi
50 echo "---------------------------------------"
51 jobTest="${mes} - Checking for PHP syntax errors"
52 jobTests+="${jobTest}\n"
54 echo "---------------------------------------"
55 - &dockers_env_start |
57 echo "---------------------------------------------------------------------"
58 echo "Start up the appropriate testing docker system to allow testing below"
59 echo "---------------------------------------------------------------------"
60 cd ci/${DOCKER_DIR} || failTest=true
61 docker-compose up -d || failTest=true
62 cd ../../ || failTest=true
69 echo "------------------------------------------------------------------------------"
70 jobTest="${mes} - Start up the appropriate testing docker system to allow testing below"
71 jobTests+="${jobTest}\n"
73 echo "------------------------------------------------------------------------------"
76 echo "------------------"
77 echo "Main OpenEMR Build"
78 echo "------------------"
79 composer install || failTest=true
80 npm install || failTest=true
81 npm run build || failTest=true
82 composer global require phing/phing || failTest=true
83 $HOME/.config/composer/vendor/bin/phing vendor-clean || failTest=true
84 $HOME/.config/composer/vendor/bin/phing assets-clean || failTest=true
85 composer global remove phing/phing || failTest=true
86 composer dump-autoload -o || failTest=true
87 rm -fr node_modules || failTest=true
94 echo "---------------------------"
95 jobTest="${mes} - Main OpenEMR Build"
96 jobTests+="${jobTest}\n"
98 echo "---------------------------"
101 echo "------------------"
102 echo "CCDA OpenEMR Build"
103 echo "------------------"
104 cd ccdaservice || failTest=true
105 npm install || failTest=true
106 cd ../ || failTest=true
113 echo "---------------------------"
114 jobTest="${mes} - CCDA OpenEMR Build"
115 jobTests+="${jobTest}\n"
117 echo "---------------------------"
118 - &install_configure |
120 echo "----------------------------------------------------------------------------------------------"
121 echo "Install and Configure OpenEMR for testing (remove registration modal on login and turn on api)"
122 echo "----------------------------------------------------------------------------------------------"
123 sudo chmod 666 sites/default/sqlconf.php || failTest=true
124 sudo chown -R www-data:www-data sites/default/documents || failTest=true
125 sed -e 's@^exit;@ @' < contrib/util/installScripts/InstallerAuto.php > contrib/util/installScripts/InstallerAutoTemp.php || failTest=true
126 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
127 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "rm -f ${OPENEMR_DIR}/contrib/util/installScripts/InstallerAutoTemp.php" || failTest=true
128 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
129 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
136 echo "-------------------------------------------------------------------------------------------------------"
137 jobTest="${mes} - Install and Configure OpenEMR for testing (remove registration modal on login and turn on api)"
138 jobTests+="${jobTest}\n"
140 echo "-------------------------------------------------------------------------------------------------------"
143 echo "---------------"
144 echo "Run Unit Tests"
145 echo "---------------"
146 php vendor/bin/phpunit --testsuite unit --testdox || failTest=true
153 echo "-----------------------"
154 jobTest="${mes} - Run Unit Tests"
155 jobTests+="${jobTest}\n"
157 echo "-----------------------"
163 php vendor/bin/phpunit --testsuite e2e --testdox || failTest=true
170 echo "----------------------"
171 jobTest="${mes} - Run E2e Tests"
172 jobTests+="${jobTest}\n"
174 echo "----------------------"
180 php vendor/bin/phpunit --testsuite api --testdox || failTest=true
187 echo "----------------------"
188 jobTest="${mes} - Run Api Tests"
189 jobTests+="${jobTest}\n"
191 echo "----------------------"
192 - &job_summary_prep |
198 jobSummary="--------------------------------------------\n"
199 jobSummary+="--------------------------------------------\n"
200 jobSummary+="${mes} - JOB SUMMARY\n"
201 jobSummary+="--------------------------------------------\n"
202 jobSummary+="${jobTests}"
203 jobSummary+="--------------------------------------------"
205 - echo "extension=ldap.so" >>php --ini | grep "Loaded Configuration" | sed -e "s|.:\s||"``
207 - echo 'error_reporting = "E_ALL & ~E_NOTICE & ~E_STRICT"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
214 - *composer_github_auth
217 - echo -e "${jobSummary}"
218 - if $failJob; then travis_terminate 1; fi
219 - name: 'Syntax - PHP 7.2'
225 - echo -e "${jobSummary}"
226 - if $failJob; then travis_terminate 1; fi
227 - name: 'Syntax - PHP 7.3'
233 - echo -e "${jobSummary}"
234 - if $failJob; then travis_terminate 1; fi
235 - name: 'Syntax - PHP 7.4'
241 - echo -e "${jobSummary}"
242 - if $failJob; then travis_terminate 1; fi
243 - name: 'Syntax - PHP 8.0'
249 - echo -e "${jobSummary}"
250 - if $failJob; then travis_terminate 1; fi
251 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.5'
254 - DOCKER_DIR=apache_73_105
255 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
259 - *composer_github_auth
267 - echo -e "${jobSummary}"
268 - if $failJob; then travis_terminate 1; fi
269 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.4'
272 - DOCKER_DIR=apache_73_104
273 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
277 - *composer_github_auth
285 - echo -e "${jobSummary}"
286 - if $failJob; then travis_terminate 1; fi
287 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.3'
290 - DOCKER_DIR=apache_73_103
291 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
295 - *composer_github_auth
303 - echo -e "${jobSummary}"
304 - if $failJob; then travis_terminate 1; fi
305 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.2'
308 - DOCKER_DIR=apache_73_102
309 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
313 - *composer_github_auth
321 - echo -e "${jobSummary}"
322 - if $failJob; then travis_terminate 1; fi
323 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.1'
326 - DOCKER_DIR=apache_73_101
327 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
331 - *composer_github_auth
339 - echo -e "${jobSummary}"
340 - if $failJob; then travis_terminate 1; fi
341 - name: 'Build and test - PHP 7.3 - Apache - MySQL 8'
344 - DOCKER_DIR=apache_73_8
345 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
349 - *composer_github_auth
357 - echo -e "${jobSummary}"
358 - if $failJob; then travis_terminate 1; fi
359 - name: 'Build and test - PHP 7.3 - Apache - MySQL 5.7'
362 - DOCKER_DIR=apache_73_57
363 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
367 - *composer_github_auth
375 - echo -e "${jobSummary}"
376 - if $failJob; then travis_terminate 1; fi
377 - name: 'Build and test - PHP 7.3 - Apache - MySQL 5.6'
380 - DOCKER_DIR=apache_73_56
381 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
385 - *composer_github_auth
393 - echo -e "${jobSummary}"
394 - if $failJob; then travis_terminate 1; fi
395 - name: 'Build and test - PHP 7.2 - Nginx - MariaDB 10.4'
398 - DOCKER_DIR=nginx_72
399 - OPENEMR_DIR=/usr/share/nginx/html/openemr
403 - *composer_github_auth
411 - echo -e "${jobSummary}"
412 - if $failJob; then travis_terminate 1; fi
413 - name: 'Build and test - PHP 7.3 - Nginx - MariaDB 10.4'
416 - DOCKER_DIR=nginx_73
417 - OPENEMR_DIR=/usr/share/nginx/html/openemr
421 - *composer_github_auth
429 - echo -e "${jobSummary}"
430 - if $failJob; then travis_terminate 1; fi
431 - name: 'Build and test - PHP 7.4 - Nginx - MariaDB 10.4'
434 - DOCKER_DIR=nginx_74
435 - OPENEMR_DIR=/usr/share/nginx/html/openemr
439 - *composer_github_auth
447 - echo -e "${jobSummary}"
448 - if $failJob; then travis_terminate 1; fi
449 - name: 'Build and test - PHP 8.0 - Nginx - MariaDB 10.4'
452 - DOCKER_DIR=nginx_80
453 - OPENEMR_DIR=/usr/share/nginx/html/openemr
457 - *composer_github_auth
465 - echo -e "${jobSummary}"
466 - if $failJob; then travis_terminate 1; fi
468 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.5'
469 - name: 'Syntax - PHP 8.0'
470 - name: 'Build and test - PHP 8.0 - Nginx - MariaDB 10.4'