| 1 | stages: |
| 2 | - test |
| 3 | - deploy |
| 4 | |
| 5 | # Define a job that runs to check PHP syntax |
| 6 | php_syntax_check: |
| 7 | stage: test |
| 8 | image: php:latest |
| 9 | script: |
| 10 | - echo "Checking PHP syntax..." |
| 11 | - find . -name "*.php" -print0 | xargs -0 -n1 php -l |
| 12 | |
| 13 | ftp_upload: |
| 14 | stage: deploy |
| 15 | variables: |
| 16 | timftpuser: $timftpuser |
| 17 | timftphost: $timftphost |
| 18 | timftppassword: $timftppassword |
| 19 | projectftp: $projectftp |
| 20 | script: |
| 21 | - apt-get update -qy |
| 22 | - apt-get install -y lftp |
| 23 | - lftp -u $timftpuser,$timftppassword $timftphost -e "set ssl:verify-certificate no; set sftp:auto-confirm yes; rm -r $projectftp; mirror -R web $projectftp" |
| 24 | artifacts: |
| 25 | paths: |
| 26 | - web |
| 27 | needs: |
| 28 | - job: php_syntax_check |
| 29 | artifacts: false |
| 30 | only: |
| 31 | - master # Run this job only when changes are pushed to the master branch |
| 32 | except: |
| 33 | - merge_requests # Do |