| 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 | - | |
| 24 | lftp -u "$timftpuser","$timftppassword" "$timftphost" <<EOF |
| 25 | set ssl:verify-certificate no; |
| 26 | set sftp:auto-confirm yes; |
| 27 | cd "$projectftp" |
| 28 | mirror -R --delete \ |
| 29 | --exclude-glob data/** \ |
| 30 | ./web . |
| 31 | artifacts: |
| 32 | paths: |
| 33 | - web |
| 34 | needs: |
| 35 | - job: php_syntax_check |
| 36 | artifacts: false |
| 37 | only: |
| 38 | - master # Run this job only when changes are pushed to the master branch |
| 39 | except: |
| 40 | - merge_requests # Do |