sftp.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. name: SFTP 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. sftp-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. sftpd: ['openssh']
  24. name: php${{ matrix.php-versions }}-${{ matrix.sftpd }}
  25. steps:
  26. - name: Checkout server
  27. uses: actions/checkout@v3
  28. with:
  29. submodules: true
  30. - name: Set up sftpd
  31. run: |
  32. sudo mkdir /tmp/sftp
  33. sudo chown -R 0777 /tmp/sftp
  34. if [[ "${{ matrix.sftpd }}" == 'openssh' ]]; then docker run -p 2222:22 --name sftp -d -v /tmp/sftp:/home/test atmoz/sftp "test:test:::data"; fi
  35. - name: Set up php ${{ matrix.php-versions }}
  36. uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d #v2.25.2
  37. with:
  38. php-version: ${{ matrix.php-versions }}
  39. tools: phpunit:9
  40. extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
  41. env:
  42. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  43. - name: Set up Nextcloud
  44. run: |
  45. mkdir data
  46. ./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
  47. ./occ app:enable --force ${{ env.APP_NAME }}
  48. php -S localhost:8080 &
  49. - name: PHPUnit
  50. run: |
  51. echo "<?php return ['run' => true, 'host' => 'localhost:2222','user' => 'test','password' => 'test', 'root' => 'data'];" > apps/${{ env.APP_NAME }}/tests/config.sftp.php
  52. phpunit --configuration tests/phpunit-autotest-external.xml apps/files_external/tests/Storage/SftpTest.php
  53. - name: sftpd logs
  54. if: always()
  55. run: |
  56. ls -l /tmp/sftp
  57. docker logs sftp
  58. sftp-summary:
  59. runs-on: ubuntu-latest
  60. needs: sftp-tests
  61. if: always()
  62. steps:
  63. - name: Summary status
  64. run: if ${{ needs.sftp-tests.result != 'success' }}; then exit 1; fi