dialog enhancements (#3351)
[openemr.git] / .travis.yml
blob1dfe394d1afe45c91fd0f56c57454756f85a9936
1 language: php
2 addons:
3   chrome: stable
4 .steps:
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
12       else
13         echo "Not using composer github api token"
14       fi
15   - &lint_style |
16       failTest=false
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
22       if $failTest; then
23         failJob=true
24         mes="FAILED"
25       else
26         mes="PASSED"
27       fi
28       echo "-----------------------------------------------"
29       jobTest="${mes} - Checking for PHP styling (PSR2) issues"
30       jobTests+="${jobTest}\n"
31       echo "${jobTest}"
32       echo "-----------------------------------------------"
33   - &lint_syntax |
34       failTest=false
35       echo "------------------------------"
36       echo "Checking for PHP syntax errors"
37       echo "------------------------------"
38       failSyntax=false
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
41       if $failSyntax; then
42         failTest=true
43       fi
44       if $failTest; then
45         failJob=true
46         mes="FAILED"
47       else
48         mes="PASSED"
49       fi
50       echo "---------------------------------------"
51       jobTest="${mes} - Checking for PHP syntax errors"
52       jobTests+="${jobTest}\n"
53       echo "${jobTest}"
54       echo "---------------------------------------"
55   - &dockers_env_start |
56       failTest=false
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
63       if $failTest; then
64         failJob=true
65         mes="FAILED"
66       else
67         mes="PASSED"
68       fi
69       echo "------------------------------------------------------------------------------"
70       jobTest="${mes} - Start up the appropriate testing docker system to allow testing below"
71       jobTests+="${jobTest}\n"
72       echo "${jobTest}"
73       echo "------------------------------------------------------------------------------"
74   - &main_build |
75       failTest=false
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
88       if $failTest; then
89         failJob=true
90         mes="FAILED"
91       else
92         mes="PASSED"
93       fi
94       echo "---------------------------"
95       jobTest="${mes} - Main OpenEMR Build"
96       jobTests+="${jobTest}\n"
97       echo "${jobTest}"
98       echo "---------------------------"
99   - &ccda_build |
100       failTest=false
101       echo "------------------"
102       echo "CCDA OpenEMR Build"
103       echo "------------------"
104       cd ccdaservice || failTest=true
105       npm install || failTest=true
106       cd ../ || failTest=true
107       if $failTest; then
108         failJob=true
109         mes="FAILED"
110       else
111         mes="PASSED"
112       fi
113       echo "---------------------------"
114       jobTest="${mes} - CCDA OpenEMR Build"
115       jobTests+="${jobTest}\n"
116       echo "${jobTest}"
117       echo "---------------------------"
118   - &install_configure |
119       failTest=false
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
130       if $failTest; then
131         failJob=true
132         mes="FAILED"
133       else
134         mes="PASSED"
135       fi
136       echo "-------------------------------------------------------------------------------------------------------"
137       jobTest="${mes} - Install and Configure OpenEMR for testing (remove registration modal on login and turn on api)"
138       jobTests+="${jobTest}\n"
139       echo "${jobTest}"
140       echo "-------------------------------------------------------------------------------------------------------"
141   - &build_test_unit |
142       failTest=false
143       echo "---------------"
144       echo "Run Unit Tests"
145       echo "---------------"
146       php vendor/bin/phpunit --testsuite unit --testdox || failTest=true
147       if $failTest; then
148         failJob=true
149         mes="FAILED"
150       else
151         mes="PASSED"
152       fi
153       echo "-----------------------"
154       jobTest="${mes} - Run Unit Tests"
155       jobTests+="${jobTest}\n"
156       echo "${jobTest}"
157       echo "-----------------------"
158   - &build_test_e2e |
159       failTest=false
160       echo "-------------"
161       echo "Run E2e Tests"
162       echo "-------------"
163       php vendor/bin/phpunit --testsuite e2e --testdox || failTest=true
164       if $failTest; then
165         failJob=true
166         mes="FAILED"
167       else
168         mes="PASSED"
169       fi
170       echo "----------------------"
171       jobTest="${mes} - Run E2e Tests"
172       jobTests+="${jobTest}\n"
173       echo "${jobTest}"
174       echo "----------------------"
175   - &build_test_api |
176       failTest=false
177       echo "-------------"
178       echo "Run Api Tests"
179       echo "-------------"
180       php vendor/bin/phpunit --testsuite api --testdox || failTest=true
181       if $failTest; then
182         failJob=true
183         mes="FAILED"
184       else
185         mes="PASSED"
186       fi
187       echo "----------------------"
188       jobTest="${mes} - Run Api Tests"
189       jobTests+="${jobTest}\n"
190       echo "${jobTest}"
191       echo "----------------------"
192   - &job_summary_prep |
193       if $failJob; then
194         mes="FAILED"
195       else
196         mes="PASSED"
197       fi
198       jobSummary="--------------------------------------------\n"
199       jobSummary+="--------------------------------------------\n"
200       jobSummary+="${mes} - JOB SUMMARY\n"
201       jobSummary+="--------------------------------------------\n"
202       jobSummary+="${jobTests}"
203       jobSummary+="--------------------------------------------"
204 before_install:
205   - echo "extension=ldap.so" >>php --ini | grep "Loaded Configuration" | sed -e "s|.:\s||"``
206 before_script:
207   - echo 'error_reporting = "E_ALL & ~E_NOTICE & ~E_STRICT"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
208 jobs:
209   include:
210     - name: 'Psr2 style'
211       php: '7.4'
212       script:
213         - failJob=false
214         - *composer_github_auth
215         - *lint_style
216         - *job_summary_prep
217         - echo -e "${jobSummary}"
218         - if $failJob; then travis_terminate 1; fi
219     - name: 'Syntax - PHP 7.2'
220       php: '7.2'
221       script:
222         - failJob=false
223         - *lint_syntax
224         - *job_summary_prep
225         - echo -e "${jobSummary}"
226         - if $failJob; then travis_terminate 1; fi
227     - name: 'Syntax - PHP 7.3'
228       php: '7.3'
229       script:
230         - failJob=false
231         - *lint_syntax
232         - *job_summary_prep
233         - echo -e "${jobSummary}"
234         - if $failJob; then travis_terminate 1; fi
235     - name: 'Syntax - PHP 7.4'
236       php: '7.4'
237       script:
238         - failJob=false
239         - *lint_syntax
240         - *job_summary_prep
241         - echo -e "${jobSummary}"
242         - if $failJob; then travis_terminate 1; fi
243     - name: 'Syntax - PHP 8.0'
244       php: 'nightly'
245       script:
246         - failJob=false
247         - *lint_syntax
248         - *job_summary_prep
249         - echo -e "${jobSummary}"
250         - if $failJob; then travis_terminate 1; fi
251     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.5'
252       php: '7.3'
253       env:
254         - DOCKER_DIR=apache_73_105
255         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
256       script:
257         - failJob=false
258         - *dockers_env_start
259         - *composer_github_auth
260         - *main_build
261         - *ccda_build
262         - *install_configure
263         - *build_test_unit
264         - *build_test_e2e
265         - *build_test_api
266         - *job_summary_prep
267         - echo -e "${jobSummary}"
268         - if $failJob; then travis_terminate 1; fi
269     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.4'
270       php: '7.3'
271       env:
272         - DOCKER_DIR=apache_73_104
273         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
274       script:
275         - failJob=false
276         - *dockers_env_start
277         - *composer_github_auth
278         - *main_build
279         - *ccda_build
280         - *install_configure
281         - *build_test_unit
282         - *build_test_e2e
283         - *build_test_api
284         - *job_summary_prep
285         - echo -e "${jobSummary}"
286         - if $failJob; then travis_terminate 1; fi
287     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.3'
288       php: '7.3'
289       env:
290         - DOCKER_DIR=apache_73_103
291         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
292       script:
293         - failJob=false
294         - *dockers_env_start
295         - *composer_github_auth
296         - *main_build
297         - *ccda_build
298         - *install_configure
299         - *build_test_unit
300         - *build_test_e2e
301         - *build_test_api
302         - *job_summary_prep
303         - echo -e "${jobSummary}"
304         - if $failJob; then travis_terminate 1; fi
305     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.2'
306       php: '7.3'
307       env:
308         - DOCKER_DIR=apache_73_102
309         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
310       script:
311         - failJob=false
312         - *dockers_env_start
313         - *composer_github_auth
314         - *main_build
315         - *ccda_build
316         - *install_configure
317         - *build_test_unit
318         - *build_test_e2e
319         - *build_test_api
320         - *job_summary_prep
321         - echo -e "${jobSummary}"
322         - if $failJob; then travis_terminate 1; fi
323     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.1'
324       php: '7.3'
325       env:
326         - DOCKER_DIR=apache_73_101
327         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
328       script:
329         - failJob=false
330         - *dockers_env_start
331         - *composer_github_auth
332         - *main_build
333         - *ccda_build
334         - *install_configure
335         - *build_test_unit
336         - *build_test_e2e
337         - *build_test_api
338         - *job_summary_prep
339         - echo -e "${jobSummary}"
340         - if $failJob; then travis_terminate 1; fi
341     - name: 'Build and test - PHP 7.3 - Apache - MySQL 8'
342       php: '7.3'
343       env:
344         - DOCKER_DIR=apache_73_8
345         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
346       script:
347         - failJob=false
348         - *dockers_env_start
349         - *composer_github_auth
350         - *main_build
351         - *ccda_build
352         - *install_configure
353         - *build_test_unit
354         - *build_test_e2e
355         - *build_test_api
356         - *job_summary_prep
357         - echo -e "${jobSummary}"
358         - if $failJob; then travis_terminate 1; fi
359     - name: 'Build and test - PHP 7.3 - Apache - MySQL 5.7'
360       php: '7.3'
361       env:
362         - DOCKER_DIR=apache_73_57
363         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
364       script:
365         - failJob=false
366         - *dockers_env_start
367         - *composer_github_auth
368         - *main_build
369         - *ccda_build
370         - *install_configure
371         - *build_test_unit
372         - *build_test_e2e
373         - *build_test_api
374         - *job_summary_prep
375         - echo -e "${jobSummary}"
376         - if $failJob; then travis_terminate 1; fi
377     - name: 'Build and test - PHP 7.3 - Apache - MySQL 5.6'
378       php: '7.3'
379       env:
380         - DOCKER_DIR=apache_73_56
381         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
382       script:
383         - failJob=false
384         - *dockers_env_start
385         - *composer_github_auth
386         - *main_build
387         - *ccda_build
388         - *install_configure
389         - *build_test_unit
390         - *build_test_e2e
391         - *build_test_api
392         - *job_summary_prep
393         - echo -e "${jobSummary}"
394         - if $failJob; then travis_terminate 1; fi
395     - name: 'Build and test - PHP 7.2 - Nginx - MariaDB 10.4'
396       php: '7.2'
397       env:
398         - DOCKER_DIR=nginx_72
399         - OPENEMR_DIR=/usr/share/nginx/html/openemr
400       script:
401         - failJob=false
402         - *dockers_env_start
403         - *composer_github_auth
404         - *main_build
405         - *ccda_build
406         - *install_configure
407         - *build_test_unit
408         - *build_test_e2e
409         - *build_test_api
410         - *job_summary_prep
411         - echo -e "${jobSummary}"
412         - if $failJob; then travis_terminate 1; fi
413     - name: 'Build and test - PHP 7.3 - Nginx - MariaDB 10.4'
414       php: '7.3'
415       env:
416         - DOCKER_DIR=nginx_73
417         - OPENEMR_DIR=/usr/share/nginx/html/openemr
418       script:
419         - failJob=false
420         - *dockers_env_start
421         - *composer_github_auth
422         - *main_build
423         - *ccda_build
424         - *install_configure
425         - *build_test_unit
426         - *build_test_e2e
427         - *build_test_api
428         - *job_summary_prep
429         - echo -e "${jobSummary}"
430         - if $failJob; then travis_terminate 1; fi
431     - name: 'Build and test - PHP 7.4 - Nginx - MariaDB 10.4'
432       php: '7.4'
433       env:
434         - DOCKER_DIR=nginx_74
435         - OPENEMR_DIR=/usr/share/nginx/html/openemr
436       script:
437         - failJob=false
438         - *dockers_env_start
439         - *composer_github_auth
440         - *main_build
441         - *ccda_build
442         - *install_configure
443         - *build_test_unit
444         - *build_test_e2e
445         - *build_test_api
446         - *job_summary_prep
447         - echo -e "${jobSummary}"
448         - if $failJob; then travis_terminate 1; fi
449     - name: 'Build and test - PHP 8.0 - Nginx - MariaDB 10.4'
450       php: 'nightly'
451       env:
452         - DOCKER_DIR=nginx_80
453         - OPENEMR_DIR=/usr/share/nginx/html/openemr
454       script:
455         - failJob=false
456         - *dockers_env_start
457         - *composer_github_auth
458         - *main_build
459         - *ccda_build
460         - *install_configure
461         - *build_test_unit
462         - *build_test_e2e
463         - *build_test_api
464         - *job_summary_prep
465         - echo -e "${jobSummary}"
466         - if $failJob; then travis_terminate 1; fi
467   allow_failures:
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'