files-external-sftp.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. name: PHPUnit files_external sFTP
  2. on:
  3. pull_request:
  4. schedule:
  5. - cron: "5 2 * * *"
  6. concurrency:
  7. group: files-external-sftp-${{ github.head_ref || github.run_id }}
  8. cancel-in-progress: true
  9. jobs:
  10. changes:
  11. runs-on: ubuntu-latest-low
  12. outputs:
  13. src: ${{ steps.changes.outputs.src}}
  14. steps:
  15. - uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a # v3.0.1
  16. id: changes
  17. continue-on-error: true
  18. with:
  19. filters: |
  20. src:
  21. - '.github/workflows/**'
  22. - '3rdparty/**'
  23. - 'apps/files_external/**'
  24. - 'vendor/**'
  25. - 'vendor-bin/**'
  26. - 'composer.json'
  27. - 'composer.lock'
  28. - '**.php'
  29. files-external-sftp:
  30. runs-on: ubuntu-latest
  31. needs: changes
  32. if: ${{ github.repository_owner != 'nextcloud-gmbh' && needs.changes.outputs.src != 'false' }}
  33. strategy:
  34. # do not stop on another job's failure
  35. fail-fast: false
  36. matrix:
  37. php-versions: ['8.0', '8.3']
  38. sftpd: ['openssh']
  39. include:
  40. - php-versions: '8.0'
  41. coverage: ${{ github.event_name != 'pull_request' }}
  42. name: php${{ matrix.php-versions }}-${{ matrix.sftpd }}
  43. steps:
  44. - name: Checkout server
  45. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
  46. with:
  47. submodules: true
  48. - name: Set up sftpd
  49. run: |
  50. sudo mkdir /tmp/sftp
  51. sudo chown -R 0777 /tmp/sftp
  52. if [[ "${{ matrix.sftpd }}" == 'openssh' ]]; then docker run -p 2222:22 --name sftp -d -v /tmp/sftp:/home/test atmoz/sftp "test:test:::data"; fi
  53. - name: Set up php ${{ matrix.php-versions }}
  54. uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d #v2.25.2
  55. with:
  56. php-version: ${{ matrix.php-versions }}
  57. # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
  58. extensions: ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
  59. coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
  60. env:
  61. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  62. - name: Set up Nextcloud
  63. run: |
  64. composer install
  65. mkdir data
  66. ./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
  67. ./occ app:enable --force files_external
  68. echo "<?php return ['run' => true, 'host' => 'localhost:2222','user' => 'test','password' => 'test', 'root' => 'data'];" > apps/files_external/tests/config.sftp.php
  69. - name: PHPUnit
  70. run: composer run test:files_external -- \
  71. apps/files_external/tests/Storage/SftpTest.php \
  72. apps/files_external/tests/Storage/SFTP_KeyTest.php \
  73. ${{ matrix.coverage && ' --coverage-clover ./clover.xml' || '' }}
  74. - name: Upload code coverage
  75. if: ${{ !cancelled() && matrix.coverage }}
  76. uses: codecov/codecov-action@v4
  77. with:
  78. files: ./clover.xml
  79. flags: phpunit-files-external-sftp
  80. - name: sftpd logs
  81. if: always()
  82. run: |
  83. ls -l /tmp/sftp
  84. docker logs sftp
  85. sftp-summary:
  86. runs-on: ubuntu-latest-low
  87. needs: [changes, files-external-sftp]
  88. if: always()
  89. steps:
  90. - name: Summary status
  91. run: if ${{ needs.changes.outputs.src != 'false' && needs.files-external-sftp.result != 'success' }}; then exit 1; fi