files-external-smb.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  2. # SPDX-License-Identifier: MIT
  3. name: PHPUnit files_external SMB
  4. on:
  5. pull_request:
  6. schedule:
  7. - cron: "5 2 * * *"
  8. concurrency:
  9. group: files-external-smb-${{ github.head_ref || github.run_id }}
  10. cancel-in-progress: true
  11. jobs:
  12. changes:
  13. runs-on: ubuntu-latest-low
  14. outputs:
  15. src: ${{ steps.changes.outputs.src}}
  16. steps:
  17. - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  18. id: changes
  19. continue-on-error: true
  20. with:
  21. filters: |
  22. src:
  23. - '.github/workflows/**'
  24. - '3rdparty/**'
  25. - 'apps/files_external/**'
  26. - 'vendor/**'
  27. - 'vendor-bin/**'
  28. - 'composer.json'
  29. - 'composer.lock'
  30. - '**.php'
  31. files-external-smb:
  32. runs-on: ubuntu-latest
  33. needs: changes
  34. if: ${{ github.repository_owner != 'nextcloud-gmbh' && needs.changes.outputs.src != 'false' }}
  35. strategy:
  36. matrix:
  37. php-versions: ['8.1']
  38. include:
  39. - php-versions: '8.1'
  40. coverage: ${{ github.event_name != 'pull_request' }}
  41. name: php${{ matrix.php-versions }}-smb
  42. services:
  43. samba:
  44. image: ghcr.io/nextcloud/continuous-integration-samba:latest
  45. ports:
  46. - 445:445
  47. steps:
  48. - name: Checkout server
  49. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
  50. with:
  51. submodules: true
  52. - name: Set up php ${{ matrix.php-versions }}
  53. uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 #v2.31.1
  54. with:
  55. php-version: ${{ matrix.php-versions }}
  56. # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
  57. 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
  58. coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
  59. ini-file: development
  60. env:
  61. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  62. - name: Set up smbclient
  63. # This is needed as icewind/smb php library for notify
  64. run: sudo apt-get install -y smbclient
  65. - name: Set up Nextcloud
  66. run: |
  67. composer install
  68. ./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
  69. ./occ config:system:set --value true --type boolean allow_local_remote_servers
  70. ./occ app:enable --force files_external
  71. echo "<?php return ['run'=>true, 'host'=>'localhost', 'user'=>'test', 'password'=>'test', 'root'=>'', 'share'=>'public'];" > apps/files_external/tests/config.smb.php
  72. - name: Wait for smb
  73. run: |
  74. apps/files_external/tests/env/wait-for-connection 127.0.0.1 445 60
  75. - name: PHPUnit
  76. run: composer run test:files_external -- --verbose \
  77. apps/files_external/tests/Storage/SmbTest.php \
  78. ${{ matrix.coverage && ' --coverage-clover ./clover.xml' || '' }}
  79. - name: Upload code coverage
  80. if: ${{ !cancelled() && matrix.coverage }}
  81. uses: codecov/codecov-action@e43f28e103e52bb26d252b5a97fcdfa06175321e # v4.1.1
  82. with:
  83. files: ./clover.xml
  84. flags: phpunit-files-external-smb
  85. files-external-smb-summary:
  86. runs-on: ubuntu-latest-low
  87. needs: [changes, files-external-smb]
  88. if: always()
  89. steps:
  90. - name: Summary status
  91. run: if ${{ needs.changes.outputs.src != 'false' && needs.files-external-smb.result != 'success' }}; then exit 1; fi