Remove Publish Provider Client feature v6.0.0 (#4054)
[openemr.git] / .travis.yml
blob1e813c29120fe38c9769b353561b90e0ba58040e
1 dist: bionic
2 language: php
3 .steps:
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
11       else
12         echo "Not using composer github api token"
13       fi
14   - &lint_style |
15       failTest=false
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
24       if $failTest; then
25         failJob=true
26         mes="FAILED"
27       else
28         mes="PASSED"
29       fi
30       echo "-----------------------------------------------"
31       jobTest="${mes} - Checking for PHP styling (PSR-12) issues"
32       jobTests+="${jobTest}\n"
33       echo "${jobTest}"
34       echo "-----------------------------------------------"
35   - &lint_theme_style |
36       failTest=false
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
43       if $failTest; then
44         failJob=true
45         mes="FAILED"
46       else
47         mes="PASSED"
48       fi
49       echo "-----------------------------------------------"
50       jobTest="${mes} - Checking for PHP theme styling issues"
51       jobTests+="${jobTest}\n"
52       echo "${jobTest}"
53       echo "-----------------------------------------------"
54   - &lint_syntax |
55       failTest=false
56       echo "------------------------------"
57       echo "Checking for PHP syntax errors"
58       echo "------------------------------"
59       failSyntax=false
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
62       if $failSyntax; then
63         failTest=true
64       fi
65       if $failTest; then
66         failJob=true
67         mes="FAILED"
68       else
69         mes="PASSED"
70       fi
71       echo "---------------------------------------"
72       jobTest="${mes} - Checking for PHP syntax errors"
73       jobTests+="${jobTest}\n"
74       echo "${jobTest}"
75       echo "---------------------------------------"
76   - &dockers_env_start |
77       failTest=false
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
84       if $failTest; then
85         failJob=true
86         mes="FAILED"
87       else
88         mes="PASSED"
89       fi
90       echo "------------------------------------------------------------------------------"
91       jobTest="${mes} - Start up the appropriate testing docker system to allow testing below"
92       jobTests+="${jobTest}\n"
93       echo "${jobTest}"
94       echo "------------------------------------------------------------------------------"
95   - &main_build |
96       failTest=false
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
109       if $failTest; then
110         failJob=true
111         mes="FAILED"
112       else
113         mes="PASSED"
114       fi
115       echo "---------------------------"
116       jobTest="${mes} - Main OpenEMR Build"
117       jobTests+="${jobTest}\n"
118       echo "${jobTest}"
119       echo "---------------------------"
120   - &ccda_build |
121       failTest=false
122       echo "------------------"
123       echo "CCDA OpenEMR Build"
124       echo "------------------"
125       cd ccdaservice || failTest=true
126       npm install || failTest=true
127       cd ../ || failTest=true
128       if $failTest; then
129         failJob=true
130         mes="FAILED"
131       else
132         mes="PASSED"
133       fi
134       echo "---------------------------"
135       jobTest="${mes} - CCDA OpenEMR Build"
136       jobTests+="${jobTest}\n"
137       echo "${jobTest}"
138       echo "---------------------------"
139   - &install_configure |
140       failTest=false
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
154       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 = 3 WHERE gl_name = \"oauth_password_grant\"" openemr' || failTest=true
155       if $failTest; then
156         failJob=true
157         mes="FAILED"
158       else
159         mes="PASSED"
160       fi
161       echo "-------------------------------------------------------------------------------------------------------"
162       jobTest="${mes} - Install and Configure OpenEMR for testing (remove registration modal on login and turn on api)"
163       jobTests+="${jobTest}\n"
164       echo "${jobTest}"
165       echo "-------------------------------------------------------------------------------------------------------"
166   - &build_test_unit |
167       failTest=false
168       echo "---------------"
169       echo "Run Unit Tests"
170       echo "---------------"
171       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
172       if $failTest; then
173         failJob=true
174         mes="FAILED"
175       else
176         mes="PASSED"
177       fi
178       echo "-----------------------"
179       jobTest="${mes} - Run Unit Tests"
180       jobTests+="${jobTest}\n"
181       echo "${jobTest}"
182       echo "-----------------------"
183   - &build_test_e2e |
184       failTest=false
185       echo "-------------"
186       echo "Run E2e Tests"
187       echo "-------------"
188       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
189       if $failTest; then
190         failJob=true
191         mes="FAILED"
192       else
193         mes="PASSED"
194       fi
195       echo "----------------------"
196       jobTest="${mes} - Run E2e Tests"
197       jobTests+="${jobTest}\n"
198       echo "${jobTest}"
199       echo "----------------------"
200   - &build_test_api |
201       failTest=false
202       echo "-------------"
203       echo "Run Api Tests"
204       echo "-------------"
205       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
206       if $failTest; then
207         failJob=true
208         mes="FAILED"
209       else
210         mes="PASSED"
211       fi
212       echo "----------------------"
213       jobTest="${mes} - Run Api Tests"
214       jobTests+="${jobTest}\n"
215       echo "${jobTest}"
216       echo "----------------------"
217   - &build_test_fixtures |
218       failTest=false
219       echo "-------------"
220       echo "Run Fixture Tests"
221       echo "-------------"
222       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
223       if $failTest; then
224         failJob=true
225         mes="FAILED"
226       else
227         mes="PASSED"
228       fi
229       echo "----------------------"
230       jobTest="${mes} - Run Fixture Tests"
231       jobTests+="${jobTest}\n"
232       echo "${jobTest}"
233       echo "----------------------"
234   - &build_test_services |
235       failTest=false
236       echo "-------------"
237       echo "Run Service Tests"
238       echo "-------------"
239       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
240       if $failTest; then
241         failJob=true
242         mes="FAILED"
243       else
244         mes="PASSED"
245       fi
246       echo "----------------------"
247       jobTest="${mes} - Run Service Tests"
248       jobTests+="${jobTest}\n"
249       echo "${jobTest}"
250       echo "----------------------"
251   - &build_test_validators |
252       failTest=false
253       echo "-------------"
254       echo "Run Validator Tests"
255       echo "-------------"
256       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
257       if $failTest; then
258         failJob=true
259         mes="FAILED"
260       else
261         mes="PASSED"
262       fi
263       echo "----------------------"
264       jobTest="${mes} - Run Validator Tests"
265       jobTests+="${jobTest}\n"
266       echo "${jobTest}"
267       echo "----------------------"
268   - &build_test_controllers |
269       failTest=false
270       echo "-------------"
271       echo "Run Controller Tests"
272       echo "-------------"
273       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
274       if $failTest; then
275         failJob=true
276         mes="FAILED"
277       else
278         mes="PASSED"
279       fi
280       echo "----------------------"
281       jobTest="${mes} - Run Controller Tests"
282       jobTests+="${jobTest}\n"
283       echo "${jobTest}"
284       echo "----------------------"
285   - &build_test_common |
286       failTest=false
287       echo "-------------"
288       echo "Run Common Tests"
289       echo "-------------"
290       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
291       if $failTest; then
292         failJob=true
293         mes="FAILED"
294       else
295         mes="PASSED"
296       fi
297       echo "----------------------"
298       jobTest="${mes} - Run Common Tests"
299       jobTests+="${jobTest}\n"
300       echo "${jobTest}"
301       echo "----------------------"
302   - &job_summary_prep |
303       if $failJob; then
304         mes="FAILED"
305       else
306         mes="PASSED"
307       fi
308       jobSummary="--------------------------------------------\n"
309       jobSummary+="--------------------------------------------\n"
310       jobSummary+="${mes} - JOB SUMMARY\n"
311       jobSummary+="--------------------------------------------\n"
312       jobSummary+="${jobTests}"
313       jobSummary+="--------------------------------------------"
314 before_install:
315   - echo "extension=ldap.so" >>php --ini | grep "Loaded Configuration" | sed -e "s|.:\s||"``
316   - nvm install --lts
317 before_script:
318   - echo 'error_reporting = "E_ALL & ~E_NOTICE & ~E_STRICT"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
319 jobs:
320   include:
321     - name: 'Psr12 style'
322       php: '7.4'
323       script:
324         - failJob=false
325         - *composer_github_auth
326         - *lint_style
327         - *job_summary_prep
328         - echo -e "${jobSummary}"
329         - if $failJob; then travis_terminate 1; fi
330     - name: 'Theme style'
331       php: '7.4'
332       script:
333         - failJob=false
334         - *lint_theme_style
335         - *job_summary_prep
336         - echo -e "${jobSummary}"
337         - if $failJob; then travis_terminate 1; fi
338     - name: 'Syntax - PHP 7.3'
339       php: '7.3'
340       script:
341         - failJob=false
342         - *lint_syntax
343         - *job_summary_prep
344         - echo -e "${jobSummary}"
345         - if $failJob; then travis_terminate 1; fi
346     - name: 'Syntax - PHP 7.4'
347       php: '7.4'
348       script:
349         - failJob=false
350         - *lint_syntax
351         - *job_summary_prep
352         - echo -e "${jobSummary}"
353         - if $failJob; then travis_terminate 1; fi
354     - name: 'Syntax - PHP 8.0'
355       php: 'nightly'
356       script:
357         - failJob=false
358         - *lint_syntax
359         - *job_summary_prep
360         - echo -e "${jobSummary}"
361         - if $failJob; then travis_terminate 1; fi
362     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.5'
363       php: '7.3'
364       env:
365         - DOCKER_DIR=apache_73_105
366         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
367         - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
368       script:
369         - failJob=false
370         - *dockers_env_start
371         - *composer_github_auth
372         - *main_build
373         - *ccda_build
374         - *install_configure
375         - *build_test_unit
376         - *build_test_e2e
377         - *build_test_api
378         - *build_test_fixtures
379         - *build_test_services
380         - *build_test_validators
381         - *build_test_controllers
382         - *build_test_common
383         - *job_summary_prep
384         - echo -e "${jobSummary}"
385         - if $failJob; then travis_terminate 1; fi
386     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.4'
387       php: '7.3'
388       env:
389         - DOCKER_DIR=apache_73_104
390         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
391         - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
392       script:
393         - failJob=false
394         - *dockers_env_start
395         - *composer_github_auth
396         - *main_build
397         - *ccda_build
398         - *install_configure
399         - *build_test_unit
400         - *build_test_e2e
401         - *build_test_api
402         - *build_test_fixtures
403         - *build_test_services
404         - *build_test_validators
405         - *build_test_controllers
406         - *build_test_common
407         - *job_summary_prep
408         - echo -e "${jobSummary}"
409         - if $failJob; then travis_terminate 1; fi
410     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.3'
411       php: '7.3'
412       env:
413         - DOCKER_DIR=apache_73_103
414         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
415         - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
416       script:
417         - failJob=false
418         - *dockers_env_start
419         - *composer_github_auth
420         - *main_build
421         - *ccda_build
422         - *install_configure
423         - *build_test_unit
424         - *build_test_e2e
425         - *build_test_api
426         - *build_test_fixtures
427         - *build_test_services
428         - *build_test_validators
429         - *build_test_controllers
430         - *build_test_common
431         - *job_summary_prep
432         - echo -e "${jobSummary}"
433         - if $failJob; then travis_terminate 1; fi
434     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.2'
435       php: '7.3'
436       env:
437         - DOCKER_DIR=apache_73_102
438         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
439         - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
440       script:
441         - failJob=false
442         - *dockers_env_start
443         - *composer_github_auth
444         - *main_build
445         - *ccda_build
446         - *install_configure
447         - *build_test_unit
448         - *build_test_e2e
449         - *build_test_api
450         - *build_test_fixtures
451         - *build_test_services
452         - *build_test_validators
453         - *build_test_controllers
454         - *build_test_common
455         - *job_summary_prep
456         - echo -e "${jobSummary}"
457         - if $failJob; then travis_terminate 1; fi
458     - name: 'Build and test - PHP 7.3 - Apache - MySQL 8'
459       php: '7.3'
460       env:
461         - DOCKER_DIR=apache_73_8
462         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
463         - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
464       script:
465         - failJob=false
466         - *dockers_env_start
467         - *composer_github_auth
468         - *main_build
469         - *ccda_build
470         - *install_configure
471         - *build_test_unit
472         - *build_test_e2e
473         - *build_test_api
474         - *build_test_fixtures
475         - *build_test_services
476         - *build_test_validators
477         - *build_test_controllers
478         - *build_test_common
479         - *job_summary_prep
480         - echo -e "${jobSummary}"
481         - if $failJob; then travis_terminate 1; fi
482     - name: 'Build and test - PHP 7.3 - Apache - MySQL 5.7'
483       php: '7.3'
484       env:
485         - DOCKER_DIR=apache_73_57
486         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
487         - CHROMIUM_INSTALL="apk update; apk add --no-cache chromium chromium-chromedriver; export PANTHER_CHROME_DRIVER_BINARY=/usr/lib/chromium/chromedriver"
488       script:
489         - failJob=false
490         - *dockers_env_start
491         - *composer_github_auth
492         - *main_build
493         - *ccda_build
494         - *install_configure
495         - *build_test_unit
496         - *build_test_e2e
497         - *build_test_api
498         - *build_test_fixtures
499         - *build_test_services
500         - *build_test_validators
501         - *build_test_controllers
502         - *build_test_common
503         - *job_summary_prep
504         - echo -e "${jobSummary}"
505         - if $failJob; then travis_terminate 1; fi
506     - name: 'Build and test - PHP 7.3 - Nginx - MariaDB 10.5'
507       php: '7.3'
508       env:
509         - DOCKER_DIR=nginx_73
510         - OPENEMR_DIR=/usr/share/nginx/html/openemr
511         - CHROMIUM_INSTALL="apt-get update; apt-get install -y chromium-driver; export PANTHER_CHROME_DRIVER_BINARY=/usr/bin/chromedriver"
512       script:
513         - failJob=false
514         - *dockers_env_start
515         - *composer_github_auth
516         - *main_build
517         - *ccda_build
518         - *install_configure
519         - *build_test_unit
520         - *build_test_e2e
521         - *build_test_api
522         - *build_test_fixtures
523         - *build_test_services
524         - *build_test_validators
525         - *build_test_controllers
526         - *build_test_common
527         - *job_summary_prep
528         - echo -e "${jobSummary}"
529         - if $failJob; then travis_terminate 1; fi
530     - name: 'Build and test - PHP 7.4 - Nginx - MariaDB 10.5'
531       php: '7.4'
532       env:
533         - DOCKER_DIR=nginx_74
534         - OPENEMR_DIR=/usr/share/nginx/html/openemr
535         - CHROMIUM_INSTALL="apt-get update; apt-get install -y chromium-driver; export PANTHER_CHROME_DRIVER_BINARY=/usr/bin/chromedriver"
536       script:
537         - failJob=false
538         - *dockers_env_start
539         - *composer_github_auth
540         - *main_build
541         - *ccda_build
542         - *install_configure
543         - *build_test_unit
544         - *build_test_e2e
545         - *build_test_api
546         - *build_test_fixtures
547         - *build_test_services
548         - *build_test_validators
549         - *build_test_controllers
550         - *build_test_common
551         - *job_summary_prep
552         - echo -e "${jobSummary}"
553         - if $failJob; then travis_terminate 1; fi
554     - name: 'Build and test - PHP 8.0 - Nginx - MariaDB 10.5'
555       php: 'nightly'
556       env:
557         - DOCKER_DIR=nginx_80
558         - OPENEMR_DIR=/usr/share/nginx/html/openemr
559         - CHROMIUM_INSTALL="apt-get update; apt-get install -y chromium-driver; export PANTHER_CHROME_DRIVER_BINARY=/usr/bin/chromedriver"
560       script:
561         - failJob=false
562         - *dockers_env_start
563         - *composer_github_auth
564         - *main_build
565         - *ccda_build
566         - *install_configure
567         - *build_test_unit
568         #- *build_test_e2e
569         #- *build_test_api
570         - *build_test_fixtures
571         - *build_test_services
572         - *build_test_validators
573         - *build_test_controllers
574         - *build_test_common
575         - *job_summary_prep
576         - echo -e "${jobSummary}"
577         - if $failJob; then travis_terminate 1; fi