1
0

ftp.yml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. name: FTP unit tests
  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. if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
  18. strategy:
  19. # do not stop on another job's failure
  20. fail-fast: false
  21. matrix:
  22. php-versions: ['8.0']
  23. ftpd: ['proftpd', 'vsftpd', 'pure-ftpd']
  24. name: php${{ matrix.php-versions }}-${{ matrix.ftpd }}
  25. steps:
  26. - name: Checkout server
  27. uses: actions/checkout@v3
  28. with:
  29. submodules: true
  30. - name: Set up ftpd
  31. run: |
  32. sudo mkdir /tmp/ftp
  33. sudo chown -R 0777 /tmp/ftp
  34. 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
  35. 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
  36. 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
  37. - name: Set up php ${{ matrix.php-versions }}
  38. uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d #v2.25.2
  39. with:
  40. php-version: ${{ matrix.php-versions }}
  41. tools: phpunit:9
  42. extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
  43. env:
  44. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  45. - name: Set up Nextcloud
  46. run: |
  47. mkdir data
  48. ./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
  49. ./occ app:enable --force ${{ env.APP_NAME }}
  50. php -S localhost:8080 &
  51. - name: smoketest ftp
  52. run: |
  53. php -r 'var_dump(file_put_contents("ftp://test:test@localhost/ftp.txt", "asd"));'
  54. php -r 'var_dump(file_get_contents("ftp://test:test@localhost/ftp.txt"));'
  55. php -r 'var_dump(mkdir("ftp://test:test@localhost/asdads"));'
  56. ls -l /tmp/ftp
  57. - name: PHPUnit
  58. run: |
  59. echo "<?php return ['run' => true,'host' => 'localhost','user' => 'test','password' => 'test', 'root' => ''];" > apps/${{ env.APP_NAME }}/tests/config.ftp.php
  60. phpunit --configuration tests/phpunit-autotest-external.xml apps/files_external/tests/Storage/FtpTest.php
  61. - name: ftpd logs
  62. if: always()
  63. run: |
  64. docker logs ftp
  65. ftp-summary:
  66. runs-on: ubuntu-latest
  67. needs: ftp-tests
  68. if: always()
  69. steps:
  70. - name: Summary status
  71. run: if ${{ needs.ftp-tests.result != 'success' }}; then exit 1; fi