4 - &composer_github_auth |
5 githubTokenRateLimitRequest=`curl -H "Authorization: token 310659f0a8658693af9ccb9da8969584b598910a" https://api.github.com/rate_limit`
6 githubTokenRateLimit=`echo $githubTokenRateLimitRequest | jq '.rate.remaining'`
7 echo "Number of github api requests remaining is $githubTokenRateLimit"
8 if [ "$githubTokenRateLimit" -gt 500 ]; then
9 echo "Using composer github api token"
10 composer config --global --auth github-oauth.github.com 310659f0a8658693af9ccb9da8969584b598910a
12 echo "Not using composer github api token"
16 echo "--------------------------------------"
17 echo "Checking for PHP styling (PSR-12) issues"
18 echo "--------------------------------------"
19 composer global require "squizlabs/php_codesniffer=3.*" || failTest=true
20 $HOME/.config/composer/vendor/bin/phpcs -p -n --extensions=php,inc --report-width=120 --standard=ci/phpcs.xml --report=full . || failTest=true
21 # todo clean up method visibility and other refactors in src/
22 # $HOME/.config/composer/vendor/bin/phpcs -p -n --extensions=php,inc --report-width=120 --standard=ci/phpcs_src.xml --report=full src/ || failTest=true
30 echo "-----------------------------------------------"
31 jobTest="${mes} - Checking for PHP styling (PSR-12) issues"
32 jobTests+="${jobTest}\n"
34 echo "-----------------------------------------------"
37 echo "--------------------------------------"
38 echo "Checking for PHP theme styling issues"
39 echo "--------------------------------------"
40 npm install || failTest=true
41 npx stylelint "**/*.css" || failTest=true
42 npx stylelint "**/*.scss" || failTest=true
49 echo "-----------------------------------------------"
50 jobTest="${mes} - Checking for PHP theme styling issues"
51 jobTests+="${jobTest}\n"
53 echo "-----------------------------------------------"
56 echo "------------------------------"
57 echo "Checking for PHP syntax errors"
58 echo "------------------------------"
60 if find . -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"; then failSyntax=true; fi
61 if find . -type f -name "*.inc" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"; then failSyntax=true; fi
71 echo "---------------------------------------"
72 jobTest="${mes} - Checking for PHP syntax errors"
73 jobTests+="${jobTest}\n"
75 echo "---------------------------------------"
76 - &dockers_env_start |
78 echo "---------------------------------------------------------------------"
79 echo "Start up the appropriate testing docker system to allow testing below"
80 echo "---------------------------------------------------------------------"
81 cd ci/${DOCKER_DIR} || failTest=true
82 docker-compose up -d || failTest=true
83 cd ../../ || failTest=true
90 echo "------------------------------------------------------------------------------"
91 jobTest="${mes} - Start up the appropriate testing docker system to allow testing below"
92 jobTests+="${jobTest}\n"
94 echo "------------------------------------------------------------------------------"
97 echo "------------------"
98 echo "Main OpenEMR Build"
99 echo "------------------"
100 composer install || failTest=true
101 npm install || failTest=true
102 npm run build || failTest=true
103 composer global require phing/phing || failTest=true
104 $HOME/.config/composer/vendor/bin/phing vendor-clean || failTest=true
105 $HOME/.config/composer/vendor/bin/phing assets-clean || failTest=true
106 composer global remove phing/phing || failTest=true
107 composer dump-autoload -o || failTest=true
108 rm -fr node_modules || failTest=true
115 echo "---------------------------"
116 jobTest="${mes} - Main OpenEMR Build"
117 jobTests+="${jobTest}\n"
119 echo "---------------------------"
122 echo "------------------"
123 echo "CCDA OpenEMR Build"
124 echo "------------------"
125 cd ccdaservice || failTest=true
126 npm install || failTest=true
127 cd ../ || failTest=true
134 echo "---------------------------"
135 jobTest="${mes} - CCDA OpenEMR Build"
136 jobTests+="${jobTest}\n"
138 echo "---------------------------"
139 - &install_configure |
141 echo "----------------------------------------------------------------------------------------------"
142 echo "Install and Configure OpenEMR for testing (remove registration modal on login and turn on api)"
143 echo "----------------------------------------------------------------------------------------------"
144 sudo chmod 666 sites/default/sqlconf.php || failTest=true
145 sudo chmod -R 777 sites/default/documents || failTest=true
146 sed -e 's@^exit;@ @' < contrib/util/installScripts/InstallerAuto.php > contrib/util/installScripts/InstallerAutoTemp.php || failTest=true
147 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
148 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "rm -f ${OPENEMR_DIR}/contrib/util/installScripts/InstallerAutoTemp.php" || failTest=true
149 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
150 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
151 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_fhir_api\"" openemr' || failTest=true
152 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_portal_api\"" openemr' || failTest=true
153 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_portal_fhir_api\"" openemr' || failTest=true
160 echo "-------------------------------------------------------------------------------------------------------"
161 jobTest="${mes} - Install and Configure OpenEMR for testing (remove registration modal on login and turn on api)"
162 jobTests+="${jobTest}\n"
164 echo "-------------------------------------------------------------------------------------------------------"
167 echo "---------------"
168 echo "Run Unit Tests"
169 echo "---------------"
170 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "cd ${OPENEMR_DIR}; php ${OPENEMR_DIR}/vendor/bin/phpunit --testsuite unit --testdox" || failTest=true
177 echo "-----------------------"
178 jobTest="${mes} - Run Unit Tests"
179 jobTests+="${jobTest}\n"
181 echo "-----------------------"
187 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "${CHROMIUM_INSTALL}; export PANTHER_NO_SANDBOX=1; cd ${OPENEMR_DIR}; php ${OPENEMR_DIR}/vendor/bin/phpunit --testsuite e2e --testdox" || failTest=true
194 echo "----------------------"
195 jobTest="${mes} - Run E2e Tests"
196 jobTests+="${jobTest}\n"
198 echo "----------------------"
204 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "cd ${OPENEMR_DIR}; php ${OPENEMR_DIR}/vendor/bin/phpunit --testsuite api --testdox" || failTest=true
211 echo "----------------------"
212 jobTest="${mes} - Run Api Tests"
213 jobTests+="${jobTest}\n"
215 echo "----------------------"
216 - &build_test_fixtures |
219 echo "Run Fixture Tests"
221 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "cd ${OPENEMR_DIR}; php ${OPENEMR_DIR}/vendor/bin/phpunit --testsuite fixtures --testdox" || failTest=true
228 echo "----------------------"
229 jobTest="${mes} - Run Fixture Tests"
230 jobTests+="${jobTest}\n"
232 echo "----------------------"
233 - &build_test_services |
236 echo "Run Service Tests"
238 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "cd ${OPENEMR_DIR}; php ${OPENEMR_DIR}/vendor/bin/phpunit --testsuite services --testdox" || failTest=true
245 echo "----------------------"
246 jobTest="${mes} - Run Service Tests"
247 jobTests+="${jobTest}\n"
249 echo "----------------------"
250 - &build_test_validators |
253 echo "Run Validator Tests"
255 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "cd ${OPENEMR_DIR}; php ${OPENEMR_DIR}/vendor/bin/phpunit --testsuite validators --testdox" || failTest=true
262 echo "----------------------"
263 jobTest="${mes} - Run Validator Tests"
264 jobTests+="${jobTest}\n"
266 echo "----------------------"
267 - &build_test_controllers |
270 echo "Run Controller Tests"
272 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "cd ${OPENEMR_DIR}; php ${OPENEMR_DIR}/vendor/bin/phpunit --testsuite controllers --testdox" || failTest=true
279 echo "----------------------"
280 jobTest="${mes} - Run Controller Tests"
281 jobTests+="${jobTest}\n"
283 echo "----------------------"
284 - &build_test_common |
287 echo "Run Common Tests"
289 docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c "cd ${OPENEMR_DIR}; php ${OPENEMR_DIR}/vendor/bin/phpunit --testsuite common --testdox" || failTest=true
296 echo "----------------------"
297 jobTest="${mes} - Run Common Tests"
298 jobTests+="${jobTest}\n"
300 echo "----------------------"
301 - &job_summary_prep |
307 jobSummary="--------------------------------------------\n"
308 jobSummary+="--------------------------------------------\n"
309 jobSummary+="${mes} - JOB SUMMARY\n"
310 jobSummary+="--------------------------------------------\n"
311 jobSummary+="${jobTests}"
312 jobSummary+="--------------------------------------------"
314 - echo "extension=ldap.so" >>php --ini | grep "Loaded Configuration" | sed -e "s|.:\s||"``
317 - echo 'error_reporting = "E_ALL & ~E_NOTICE & ~E_STRICT"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
320 - name: 'Psr12 style'
324 - *composer_github_auth
327 - echo -e "${jobSummary}"
328 - if $failJob; then travis_terminate 1; fi
329 - name: 'Theme style'
335 - echo -e "${jobSummary}"
336 - if $failJob; then travis_terminate 1; fi
337 - name: 'Syntax - PHP 7.3'
343 - echo -e "${jobSummary}"
344 - if $failJob; then travis_terminate 1; fi
345 - name: 'Syntax - PHP 7.4'
351 - echo -e "${jobSummary}"
352 - if $failJob; then travis_terminate 1; fi
353 - name: 'Syntax - PHP 8.0'
359 - echo -e "${jobSummary}"
360 - if $failJob; then travis_terminate 1; fi
361 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.5'
364 - DOCKER_DIR=apache_73_105
365 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
366 - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
370 - *composer_github_auth
377 - *build_test_fixtures
378 - *build_test_services
379 - *build_test_validators
380 - *build_test_controllers
383 - echo -e "${jobSummary}"
384 - if $failJob; then travis_terminate 1; fi
385 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.4'
388 - DOCKER_DIR=apache_73_104
389 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
390 - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
394 - *composer_github_auth
401 - *build_test_fixtures
402 - *build_test_services
403 - *build_test_validators
404 - *build_test_controllers
407 - echo -e "${jobSummary}"
408 - if $failJob; then travis_terminate 1; fi
409 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.3'
412 - DOCKER_DIR=apache_73_103
413 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
414 - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
418 - *composer_github_auth
425 - *build_test_fixtures
426 - *build_test_services
427 - *build_test_validators
428 - *build_test_controllers
431 - echo -e "${jobSummary}"
432 - if $failJob; then travis_terminate 1; fi
433 - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.2'
436 - DOCKER_DIR=apache_73_102
437 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
438 - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
442 - *composer_github_auth
449 - *build_test_fixtures
450 - *build_test_services
451 - *build_test_validators
452 - *build_test_controllers
455 - echo -e "${jobSummary}"
456 - if $failJob; then travis_terminate 1; fi
457 - name: 'Build and test - PHP 7.3 - Apache - MySQL 8'
460 - DOCKER_DIR=apache_73_8
461 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
462 - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
466 - *composer_github_auth
473 - *build_test_fixtures
474 - *build_test_services
475 - *build_test_validators
476 - *build_test_controllers
479 - echo -e "${jobSummary}"
480 - if $failJob; then travis_terminate 1; fi
481 - name: 'Build and test - PHP 7.3 - Apache - MySQL 5.7'
484 - DOCKER_DIR=apache_73_57
485 - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
486 - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
490 - *composer_github_auth
497 - *build_test_fixtures
498 - *build_test_services
499 - *build_test_validators
500 - *build_test_controllers
503 - echo -e "${jobSummary}"
504 - if $failJob; then travis_terminate 1; fi
505 - name: 'Build and test - PHP 7.3 - Nginx - MariaDB 10.5'
508 - DOCKER_DIR=nginx_73
509 - OPENEMR_DIR=/usr/share/nginx/html/openemr
510 - CHROMIUM_INSTALL="apt-get update; apt-get install -y chromium-driver; export PANTHER_CHROME_DRIVER_BINARY=/usr/bin/chromedriver"
514 - *composer_github_auth
521 - *build_test_fixtures
522 - *build_test_services
523 - *build_test_validators
524 - *build_test_controllers
527 - echo -e "${jobSummary}"
528 - if $failJob; then travis_terminate 1; fi
529 - name: 'Build and test - PHP 7.4 - Nginx - MariaDB 10.5'
532 - DOCKER_DIR=nginx_74
533 - OPENEMR_DIR=/usr/share/nginx/html/openemr
534 - CHROMIUM_INSTALL="apt-get update; apt-get install -y chromium-driver; export PANTHER_CHROME_DRIVER_BINARY=/usr/bin/chromedriver"
538 - *composer_github_auth
545 - *build_test_fixtures
546 - *build_test_services
547 - *build_test_validators
548 - *build_test_controllers
551 - echo -e "${jobSummary}"
552 - if $failJob; then travis_terminate 1; fi
553 - name: 'Build and test - PHP 8.0 - Nginx - MariaDB 10.5'
556 - DOCKER_DIR=nginx_80
557 - OPENEMR_DIR=/usr/share/nginx/html/openemr
558 - CHROMIUM_INSTALL="apt-get update; apt-get install -y chromium-driver; export PANTHER_CHROME_DRIVER_BINARY=/usr/bin/chromedriver"
562 - *composer_github_auth
568 - *build_test_fixtures
569 - *build_test_services
570 - *build_test_validators
571 - *build_test_controllers
574 - echo -e "${jobSummary}"
575 - if $failJob; then travis_terminate 1; fi