simple fix from switch to laminas (#2903)
[openemr.git] / .travis.yml
blob348f0b4ce3e90258b63a635409a50348e36a453a
1 language: php
2 addons:
3   chrome: stable
4 .steps:
5   - &lint_style |
6       failTest=false
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
12       if $failTest; then
13         failJob=true
14         mes="FAILED"
15       else
16         mes="PASSED"
17       fi
18       echo "-----------------------------------------------"
19       jobTest="${mes} - Checking for PHP styling (PSR2) issues"
20       jobTests+="${jobTest}\n"
21       echo "${jobTest}"
22       echo "-----------------------------------------------"
23   - &lint_syntax |
24       failTest=false
25       echo "------------------------------"
26       echo "Checking for PHP syntax errors"
27       echo "------------------------------"
28       failSyntax=false
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
31       if $failSyntax; then
32         failTest=true
33       fi
34       if $failTest; then
35         failJob=true
36         mes="FAILED"
37       else
38         mes="PASSED"
39       fi
40       echo "---------------------------------------"
41       jobTest="${mes} - Checking for PHP syntax errors"
42       jobTests+="${jobTest}\n"
43       echo "${jobTest}"
44       echo "---------------------------------------"
45   - &dockers_env_start |
46       failTest=false
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
53       if $failTest; then
54         failJob=true
55         mes="FAILED"
56       else
57         mes="PASSED"
58       fi
59       echo "------------------------------------------------------------------------------"
60       jobTest="${mes} - Start up the appropriate testing docker system to allow testing below"
61       jobTests+="${jobTest}\n"
62       echo "${jobTest}"
63       echo "------------------------------------------------------------------------------"
64   - &main_build |
65       failTest=false
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
78       if $failTest; then
79         failJob=true
80         mes="FAILED"
81       else
82         mes="PASSED"
83       fi
84       echo "---------------------------"
85       jobTest="${mes} - Main OpenEMR Build"
86       jobTests+="${jobTest}\n"
87       echo "${jobTest}"
88       echo "---------------------------"
89   - &ccda_build |
90       failTest=false
91       echo "------------------"
92       echo "CCDA OpenEMR Build"
93       echo "------------------"
94       cd ccdaservice || failTest=true
95       npm install || failTest=true
96       cd ../ || failTest=true
97       if $failTest; then
98         failJob=true
99         mes="FAILED"
100       else
101         mes="PASSED"
102       fi
103       echo "---------------------------"
104       jobTest="${mes} - CCDA OpenEMR Build"
105       jobTests+="${jobTest}\n"
106       echo "${jobTest}"
107       echo "---------------------------"
108   - &install_configure |
109       failTest=false
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
120       if $failTest; then
121         failJob=true
122         mes="FAILED"
123       else
124         mes="PASSED"
125       fi
126       echo "-------------------------------------------------------------------------------------------------------"
127       jobTest="${mes} - Install and Configure OpenEMR for testing (remove registration modal on login and turn on api)"
128       jobTests+="${jobTest}\n"
129       echo "${jobTest}"
130       echo "-------------------------------------------------------------------------------------------------------"
131   - &dev_test_build |
132       failTest=false
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
139       if $failTest; then
140         failJob=true
141         mes="FAILED"
142       else
143         mes="PASSED"
144       fi
145       echo "-------------------------------"
146       jobTest="${mes} - Dev Test OpenEMR Build"
147       jobTests+="${jobTest}\n"
148       echo "${jobTest}"
149       echo "-------------------------------"
150   - &build_test_unit |
151       failTest=false
152       echo "---------------"
153       echo "Run Unit Tests"
154       echo "---------------"
155       php vendor/bin/phpunit --testsuite unit --testdox || failTest=true
156       if $failTest; then
157         failJob=true
158         mes="FAILED"
159       else
160         mes="PASSED"
161       fi
162       echo "-----------------------"
163       jobTest="${mes} - Run Unit Tests"
164       jobTests+="${jobTest}\n"
165       echo "${jobTest}"
166       echo "-----------------------"
167   - &build_test_e2e |
168       failTest=false
169       echo "-------------"
170       echo "Run E2e Tests"
171       echo "-------------"
172       php vendor/bin/phpunit --testsuite e2e --testdox || failTest=true
173       if $failTest; then
174         failJob=true
175         mes="FAILED"
176       else
177         mes="PASSED"
178       fi
179       echo "----------------------"
180       jobTest="${mes} - Run E2e Tests"
181       jobTests+="${jobTest}\n"
182       echo "${jobTest}"
183       echo "----------------------"
184   - &build_test_api |
185       failTest=false
186       echo "-------------"
187       echo "Run Api Tests"
188       echo "-------------"
189       php vendor/bin/phpunit --testsuite api --testdox || failTest=true
190       if $failTest; then
191         failJob=true
192         mes="FAILED"
193       else
194         mes="PASSED"
195       fi
196       echo "----------------------"
197       jobTest="${mes} - Run Api Tests"
198       jobTests+="${jobTest}\n"
199       echo "${jobTest}"
200       echo "----------------------"
201   - &job_summary_prep |
202       if $failJob; then
203         mes="FAILED"
204       else
205         mes="PASSED"
206       fi
207       jobSummary="--------------------------------------------\n"
208       jobSummary+="--------------------------------------------\n"
209       jobSummary+="${mes} - JOB SUMMARY\n"
210       jobSummary+="--------------------------------------------\n"
211       jobSummary+="${jobTests}"
212       jobSummary+="--------------------------------------------"
213 before_install:
214   - echo "extension=ldap.so" >>php --ini | grep "Loaded Configuration" | sed -e "s|.:\s||"``
215 before_script:
216   - echo 'error_reporting = "E_ALL & ~E_NOTICE & ~E_STRICT"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
217 jobs:
218   include:
219     - name: 'Psr2 style'
220       php: '7.4'
221       script:
222         - failJob=false
223         - *lint_style
224         - *job_summary_prep
225         - echo -e "${jobSummary}"
226         - if $failJob; then travis_terminate 1; fi
227     - name: 'Syntax - PHP 7.2'
228       php: '7.2'
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.3'
236       php: '7.3'
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 7.4'
244       php: '7.4'
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: 'Syntax - PHP 8.0'
252       php: 'nightly'
253       script:
254         - failJob=false
255         - *lint_syntax
256         - *job_summary_prep
257         - echo -e "${jobSummary}"
258         - if $failJob; then travis_terminate 1; fi
259     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.4'
260       php: '7.3'
261       env:
262         - DOCKER_DIR=apache_73_104
263         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
264       script:
265         - failJob=false
266         - *dockers_env_start
267         - *main_build
268         - *ccda_build
269         - *install_configure
270         - *dev_test_build
271         - *build_test_unit
272         - *build_test_e2e
273         - *build_test_api
274         - *job_summary_prep
275         - echo -e "${jobSummary}"
276         - if $failJob; then travis_terminate 1; fi
277     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.3'
278       php: '7.3'
279       env:
280         - DOCKER_DIR=apache_73_103
281         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
282       script:
283         - failJob=false
284         - *dockers_env_start
285         - *main_build
286         - *ccda_build
287         - *install_configure
288         - *dev_test_build
289         - *build_test_unit
290         - *build_test_e2e
291         - *build_test_api
292         - *job_summary_prep
293         - echo -e "${jobSummary}"
294         - if $failJob; then travis_terminate 1; fi
295     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.2'
296       php: '7.3'
297       env:
298         - DOCKER_DIR=apache_73_102
299         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
300       script:
301         - failJob=false
302         - *dockers_env_start
303         - *main_build
304         - *ccda_build
305         - *install_configure
306         - *dev_test_build
307         - *build_test_unit
308         - *build_test_e2e
309         - *build_test_api
310         - *job_summary_prep
311         - echo -e "${jobSummary}"
312         - if $failJob; then travis_terminate 1; fi
313     - name: 'Build and test - PHP 7.3 - Apache - MariaDB 10.1'
314       php: '7.3'
315       env:
316         - DOCKER_DIR=apache_73_101
317         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
318       script:
319         - failJob=false
320         - *dockers_env_start
321         - *main_build
322         - *ccda_build
323         - *install_configure
324         - *dev_test_build
325         - *build_test_unit
326         - *build_test_e2e
327         - *build_test_api
328         - *job_summary_prep
329         - echo -e "${jobSummary}"
330         - if $failJob; then travis_terminate 1; fi
331     - name: 'Build and test - PHP 7.3 - Apache - MySQL 8'
332       php: '7.3'
333       env:
334         - DOCKER_DIR=apache_73_8
335         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
336       script:
337         - failJob=false
338         - *dockers_env_start
339         - *main_build
340         - *ccda_build
341         - *install_configure
342         - *dev_test_build
343         - *build_test_unit
344         - *build_test_e2e
345         - *build_test_api
346         - *job_summary_prep
347         - echo -e "${jobSummary}"
348         - if $failJob; then travis_terminate 1; fi
349     - name: 'Build and test - PHP 7.3 - Apache - MySQL 5.7'
350       php: '7.3'
351       env:
352         - DOCKER_DIR=apache_73_57
353         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
354       script:
355         - failJob=false
356         - *dockers_env_start
357         - *main_build
358         - *ccda_build
359         - *install_configure
360         - *dev_test_build
361         - *build_test_unit
362         - *build_test_e2e
363         - *build_test_api
364         - *job_summary_prep
365         - echo -e "${jobSummary}"
366         - if $failJob; then travis_terminate 1; fi
367     - name: 'Build and test - PHP 7.3 - Apache - MySQL 5.6'
368       php: '7.3'
369       env:
370         - DOCKER_DIR=apache_73_56
371         - OPENEMR_DIR=/var/www/localhost/htdocs/openemr
372       script:
373         - failJob=false
374         - *dockers_env_start
375         - *main_build
376         - *ccda_build
377         - *install_configure
378         - *dev_test_build
379         - *build_test_unit
380         - *build_test_e2e
381         - *build_test_api
382         - *job_summary_prep
383         - echo -e "${jobSummary}"
384         - if $failJob; then travis_terminate 1; fi
385     - name: 'Build and test - PHP 7.2 - Nginx - MariaDB 10.4'
386       php: '7.2'
387       env:
388         - DOCKER_DIR=nginx_72
389         - OPENEMR_DIR=/usr/share/nginx/html/openemr
390       script:
391         - failJob=false
392         - *dockers_env_start
393         - *main_build
394         - *ccda_build
395         - *install_configure
396         - *dev_test_build
397         - *build_test_unit
398         - *build_test_e2e
399         - *build_test_api
400         - *job_summary_prep
401         - echo -e "${jobSummary}"
402         - if $failJob; then travis_terminate 1; fi
403     - name: 'Build and test - PHP 7.3 - Nginx - MariaDB 10.4'
404       php: '7.3'
405       env:
406         - DOCKER_DIR=nginx_73
407         - OPENEMR_DIR=/usr/share/nginx/html/openemr
408       script:
409         - failJob=false
410         - *dockers_env_start
411         - *main_build
412         - *ccda_build
413         - *install_configure
414         - *dev_test_build
415         - *build_test_unit
416         - *build_test_e2e
417         - *build_test_api
418         - *job_summary_prep
419         - echo -e "${jobSummary}"
420         - if $failJob; then travis_terminate 1; fi
421     - name: 'Build and test - PHP 7.4 - Nginx - MariaDB 10.4'
422       php: '7.4'
423       env:
424         - DOCKER_DIR=nginx_74
425         - OPENEMR_DIR=/usr/share/nginx/html/openemr
426       script:
427         - failJob=false
428         - *dockers_env_start
429         - *main_build
430         - *ccda_build
431         - *install_configure
432         - *dev_test_build
433         - *build_test_unit
434         - *build_test_e2e
435         - *build_test_api
436         - *job_summary_prep
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'
440       php: 'nightly'
441       script:
442         - failJob=false
443         - *main_build
444         - *ccda_build
445         - *dev_test_build
446         - *build_test_unit
447         - *job_summary_prep
448         - echo -e "${jobSummary}"
449         - if $failJob; then travis_terminate 1; fi
450   allow_failures:
451     - name: 'Build and test (only phpunit; no functional tests) - PHP 8.0'
452     - name: 'Syntax - PHP 8.0'