1
0

ftp.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. name: FTP unit tests
  2. on:
  3. pull_request:
  4. paths:
  5. - '.github/**'
  6. - 'apps/files_external/**'
  7. concurrency:
  8. group: ftp-${{ github.head_ref || github.run_id }}
  9. cancel-in-progress: true
  10. env:
  11. APP_NAME: files_external
  12. jobs:
  13. ftp-tests:
  14. runs-on: ubuntu-latest
  15. if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
  16. strategy:
  17. # do not stop on another job's failure
  18. fail-fast: false
  19. matrix:
  20. php-versions: ['8.0']
  21. ftpd: ['proftpd', 'vsftpd', 'pure-ftpd']
  22. name: php${{ matrix.php-versions }}-${{ matrix.ftpd }}
  23. steps:
  24. - name: Checkout server
  25. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
  26. with:
  27. submodules: true
  28. - name: Set up ftpd
  29. run: |
  30. sudo mkdir /tmp/ftp
  31. sudo chmod -R 0777 /tmp/ftp
  32. if [[ "${{ matrix.ftpd }}" == 'proftpd' ]]; then echo '$6$Q7V2n3q2GRVv5YeQ$/AhLu07H76Asojy7bxGXMY1caKLAbp5Vt82LOZYMkD/8uDzyMAEXwk0c1Bdz1DkBsk2Vh/9SF130mOPavRGMo.' > /tmp/secret.txt; fi
  33. if [[ "${{ matrix.ftpd }}" == 'proftpd' ]]; then echo 'FTP_ROOT=/home/test' > $GITHUB_ENV; fi
  34. 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
  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/ftp:/home/test -v /tmp/ftp:/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. extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
  42. env:
  43. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  44. - name: Set up Nextcloud
  45. run: |
  46. composer install
  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${{ env.FTP_ROOT }}/ftp.txt", "asd"));'
  54. php -r 'var_dump(file_get_contents("ftp://test:test@localhost${{ env.FTP_ROOT }}/ftp.txt"));'
  55. php -r 'var_dump(mkdir("ftp://test:test@localhost${{ env.FTP_ROOT }}/asdads"));'
  56. ls -l /tmp/ftp
  57. [ -f /tmp/ftp/ftp.txt ]
  58. - name: PHPUnit
  59. run: |
  60. echo "<?php return ['run' => true,'host' => 'localhost','user' => 'test','password' => 'test', 'root' => '${{ env.FTP_ROOT }}'];" > apps/${{ env.APP_NAME }}/tests/config.ftp.php
  61. composer run test:files_external apps/files_external/tests/Storage/FtpTest.php
  62. - name: ftpd logs
  63. if: always()
  64. run: |
  65. docker logs ftp
  66. ftp-summary:
  67. runs-on: ubuntu-latest
  68. needs: ftp-tests
  69. if: always()
  70. steps:
  71. - name: Summary status
  72. run: if ${{ needs.ftp-tests.result != 'success' }}; then exit 1; fi