ftp.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. name: FTP
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - stable*
  7. paths:
  8. - 'apps/files_external/**'
  9. pull_request:
  10. paths:
  11. - 'apps/files_external/**'
  12. env:
  13. APP_NAME: files_external
  14. jobs:
  15. ftp-tests:
  16. runs-on: ubuntu-latest
  17. strategy:
  18. # do not stop on another job's failure
  19. fail-fast: false
  20. matrix:
  21. php-versions: ['7.4', '8.0']
  22. ftpd: ['proftpd', 'vsftpd', 'pure-ftpd']
  23. name: php${{ matrix.php-versions }}-${{ matrix.ftpd }}
  24. steps:
  25. - name: Checkout server
  26. uses: actions/checkout@v2
  27. with:
  28. submodules: true
  29. - name: Set up ftpd
  30. run: |
  31. sudo mkdir /tmp/ftp
  32. sudo chown -R 0777 /tmp/ftp
  33. if [[ "${{ matrix.ftpd }}" == 'proftpd' ]]; then docker run --name ftp -d --net host -e FTP_USERNAME=test -e FTP_PASSWORD=test -v /tmp/ftp:/home/test hauptmedia/proftpd; fi
  34. if [[ "${{ matrix.ftpd }}" == 'vsftpd' ]]; then docker run --name ftp -d --net host -e FTP_USER=test -e FTP_PASS=test -e PASV_ADDRESS=127.0.0.1 -v /tmp/ftp:/home/vsftpd/test fauria/vsftpd; fi
  35. if [[ "${{ matrix.ftpd }}" == 'pure-ftpd' ]]; then docker run --name ftp -d --net host -e "PUBLICHOST=localhost" -e FTP_USER_NAME=test -e FTP_USER_PASS=test -e FTP_USER_HOME=/home/test -v /tmp/ftp2:/home/test -v /tmp/ftp2:/etc/pure-ftpd/passwd stilliard/pure-ftpd; fi
  36. - name: Set up php ${{ matrix.php-versions }}
  37. uses: shivammathur/setup-php@v2
  38. with:
  39. php-version: ${{ matrix.php-versions }}
  40. tools: phpunit
  41. extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
  42. - name: Set up Nextcloud
  43. run: |
  44. mkdir data
  45. ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
  46. ./occ app:enable --force ${{ env.APP_NAME }}
  47. php -S localhost:8080 &
  48. - name: smoketest ftp
  49. run: |
  50. php -r 'var_dump(file_put_contents("ftp://test:test@localhost/ftp.txt", "asd"));'
  51. php -r 'var_dump(file_get_contents("ftp://test:test@localhost/ftp.txt"));'
  52. php -r 'var_dump(mkdir("ftp://test:test@localhost/asdads"));'
  53. ls -l /tmp/ftp
  54. - name: PHPUnit
  55. run: |
  56. echo "<?php return ['run' => true,'host' => 'localhost','user' => 'test','password' => 'test', 'root' => ''];" > apps/${{ env.APP_NAME }}/tests/config.ftp.php
  57. phpunit --configuration tests/phpunit-autotest-external.xml apps/files_external/tests/Storage/FtpTest.php
  58. - name: ftpd logs
  59. if: always()
  60. run: |
  61. docker logs ftp
  62. ftp-summary:
  63. runs-on: ubuntu-latest
  64. needs: ftp-tests
  65. if: always()
  66. steps:
  67. - name: Summary status
  68. run: if ${{ needs.ftp-tests.result != 'success' }}; then exit 1; fi