sftp.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. name: SFTP unit tests
  2. on:
  3. pull_request:
  4. paths:
  5. - 'apps/files_external/**'
  6. env:
  7. APP_NAME: files_external
  8. concurrency:
  9. group: sftp-${{ github.head_ref || github.run_id }}
  10. cancel-in-progress: true
  11. jobs:
  12. sftp-tests:
  13. runs-on: ubuntu-latest
  14. if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
  15. strategy:
  16. # do not stop on another job's failure
  17. fail-fast: false
  18. matrix:
  19. php-versions: ['8.0']
  20. sftpd: ['openssh']
  21. name: php${{ matrix.php-versions }}-${{ matrix.sftpd }}
  22. steps:
  23. - name: Checkout server
  24. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
  25. with:
  26. submodules: true
  27. - name: Set up sftpd
  28. run: |
  29. sudo mkdir /tmp/sftp
  30. sudo chown -R 0777 /tmp/sftp
  31. if [[ "${{ matrix.sftpd }}" == 'openssh' ]]; then docker run -p 2222:22 --name sftp -d -v /tmp/sftp:/home/test atmoz/sftp "test:test:::data"; fi
  32. - name: Set up php ${{ matrix.php-versions }}
  33. uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d #v2.25.2
  34. with:
  35. php-version: ${{ matrix.php-versions }}
  36. extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
  37. env:
  38. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  39. - name: Set up Nextcloud
  40. run: |
  41. composer install
  42. mkdir data
  43. ./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
  44. ./occ app:enable --force ${{ env.APP_NAME }}
  45. php -S localhost:8080 &
  46. - name: PHPUnit
  47. run: |
  48. echo "<?php return ['run' => true, 'host' => 'localhost:2222','user' => 'test','password' => 'test', 'root' => 'data'];" > apps/${{ env.APP_NAME }}/tests/config.sftp.php
  49. composer run test:files_external apps/files_external/tests/Storage/SftpTest.php
  50. - name: sftpd logs
  51. if: always()
  52. run: |
  53. ls -l /tmp/sftp
  54. docker logs sftp
  55. sftp-summary:
  56. runs-on: ubuntu-latest
  57. needs: sftp-tests
  58. if: always()
  59. steps:
  60. - name: Summary status
  61. run: if ${{ needs.sftp-tests.result != 'success' }}; then exit 1; fi