ftp.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. name: FTP unit tests
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - stable*
  7. paths:
  8. - '.github/**'
  9. - 'apps/files_external/**'
  10. pull_request:
  11. paths:
  12. - '.github/**'
  13. - 'apps/files_external/**'
  14. env:
  15. APP_NAME: files_external
  16. jobs:
  17. ftp-tests:
  18. runs-on: ubuntu-latest
  19. if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
  20. strategy:
  21. # do not stop on another job's failure
  22. fail-fast: false
  23. matrix:
  24. php-versions: ['8.0']
  25. ftpd: ['proftpd', 'vsftpd', 'pure-ftpd']
  26. name: php${{ matrix.php-versions }}-${{ matrix.ftpd }}
  27. steps:
  28. - name: Checkout server
  29. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
  30. with:
  31. submodules: true
  32. - name: Set up ftpd
  33. run: |
  34. sudo mkdir /tmp/ftp
  35. sudo chmod -R 0777 /tmp/ftp
  36. if [[ "${{ matrix.ftpd }}" == 'proftpd' ]]; then echo '$6$Q7V2n3q2GRVv5YeQ$/AhLu07H76Asojy7bxGXMY1caKLAbp5Vt82LOZYMkD/8uDzyMAEXwk0c1Bdz1DkBsk2Vh/9SF130mOPavRGMo.' > /tmp/secret.txt; fi
  37. if [[ "${{ matrix.ftpd }}" == 'proftpd' ]]; then echo 'FTP_ROOT=/home/test' > $GITHUB_ENV; fi
  38. if [[ "${{ matrix.ftpd }}" == 'proftpd' ]]; then docker run --name ftp -d --net host -e PASV_ADDRESS=127.0.0.1 -e FTPUSER_NAME=test -v /tmp/secret.txt:/run/secrets/ftp-user-password-secret -v /tmp/ftp:/home/test instantlinux/proftpd; fi
  39. 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
  40. 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/ftp:/home/test -v /tmp/ftp:/etc/pure-ftpd/passwd stilliard/pure-ftpd; fi
  41. - name: Set up php ${{ matrix.php-versions }}
  42. uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d #v2.25.2
  43. with:
  44. php-version: ${{ matrix.php-versions }}
  45. extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
  46. env:
  47. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  48. - name: Set up Nextcloud
  49. run: |
  50. composer install
  51. mkdir data
  52. ./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
  53. ./occ app:enable --force ${{ env.APP_NAME }}
  54. php -S localhost:8080 &
  55. - name: smoketest ftp
  56. run: |
  57. php -r 'var_dump(file_put_contents("ftp://test:test@localhost${{ env.FTP_ROOT }}/ftp.txt", "asd"));'
  58. php -r 'var_dump(file_get_contents("ftp://test:test@localhost${{ env.FTP_ROOT }}/ftp.txt"));'
  59. php -r 'var_dump(mkdir("ftp://test:test@localhost${{ env.FTP_ROOT }}/asdads"));'
  60. ls -l /tmp/ftp
  61. [ -f /tmp/ftp/ftp.txt ]
  62. - name: PHPUnit
  63. run: |
  64. echo "<?php return ['run' => true,'host' => 'localhost','user' => 'test','password' => 'test', 'root' => '${{ env.FTP_ROOT }}'];" > apps/${{ env.APP_NAME }}/tests/config.ftp.php
  65. composer run test:files_external apps/files_external/tests/Storage/FtpTest.php
  66. - name: ftpd logs
  67. if: always()
  68. run: |
  69. docker logs ftp
  70. ftp-summary:
  71. runs-on: ubuntu-latest
  72. needs: ftp-tests
  73. if: always()
  74. steps:
  75. - name: Summary status
  76. run: if ${{ needs.ftp-tests.result != 'success' }}; then exit 1; fi