files-external-smb.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. name: PHPUnit files_external SMB
  2. on:
  3. pull_request:
  4. schedule:
  5. - cron: "5 2 * * *"
  6. concurrency:
  7. group: files-external-smb-${{ 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@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  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-smb:
  30. runs-on: ubuntu-latest
  31. needs: changes
  32. if: ${{ github.repository_owner != 'nextcloud-gmbh' && needs.changes.outputs.src != 'false' }}
  33. strategy:
  34. matrix:
  35. php-versions: ['8.0', '8.3']
  36. include:
  37. - php-versions: '8.0'
  38. coverage: ${{ github.event_name != 'pull_request' }}
  39. name: php${{ matrix.php-versions }}-smb
  40. services:
  41. samba:
  42. image: ghcr.io/nextcloud/continuous-integration-samba:latest
  43. ports:
  44. - 445:445
  45. steps:
  46. - name: Checkout server
  47. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  48. with:
  49. submodules: true
  50. - name: Set up php ${{ matrix.php-versions }}
  51. uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
  52. with:
  53. php-version: ${{ matrix.php-versions }}
  54. # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
  55. extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, smbclient, sqlite, pdo_sqlite
  56. coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
  57. ini-file: development
  58. env:
  59. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  60. - name: Set up smbclient
  61. # This is needed as icewind/smb php library for notify
  62. run: sudo apt-get install -y smbclient
  63. - name: Set up Nextcloud
  64. run: |
  65. composer install
  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 config:system:set --value true --type boolean allow_local_remote_servers
  68. ./occ app:enable --force files_external
  69. echo "<?php return ['run'=>true, 'host'=>'localhost', 'user'=>'test', 'password'=>'test', 'root'=>'', 'share'=>'public'];" > apps/files_external/tests/config.smb.php
  70. - name: Wait for smb
  71. run: |
  72. apps/files_external/tests/env/wait-for-connection 127.0.0.1 445 60
  73. - name: PHPUnit
  74. run: composer run test:files_external -- --verbose \
  75. apps/files_external/tests/Storage/SmbTest.php \
  76. ${{ matrix.coverage && ' --coverage-clover ./clover.xml' || '' }}
  77. - name: Upload code coverage
  78. if: ${{ !cancelled() && matrix.coverage }}
  79. uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5
  80. with:
  81. files: ./clover.xml
  82. flags: phpunit-files-external-smb
  83. files-external-smb-summary:
  84. runs-on: ubuntu-latest-low
  85. needs: [changes, files-external-smb]
  86. if: always()
  87. steps:
  88. - name: Summary status
  89. run: if ${{ needs.changes.outputs.src != 'false' && needs.files-external-smb.result != 'success' }}; then exit 1; fi