object-storage-s3.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. name: Object storage S3
  2. on:
  3. pull_request:
  4. schedule:
  5. - cron: "15 2 * * *"
  6. concurrency:
  7. group: object-storage-s3-${{ 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. - '**/appinfo/**'
  24. - '**/lib/**'
  25. - '**/templates/**'
  26. - '**/tests/**'
  27. - 'vendor/**'
  28. - 'vendor-bin/**'
  29. - '.php-cs-fixer.dist.php'
  30. - 'composer.json'
  31. - 'composer.lock'
  32. - '**.php'
  33. s3-primary-tests-minio:
  34. runs-on: ubuntu-22.04
  35. needs: changes
  36. if: ${{ github.repository_owner != 'nextcloud-gmbh' && needs.changes.outputs.src != 'false' }}
  37. strategy:
  38. matrix:
  39. php-versions: ['8.1', '8.2', '8.3']
  40. include:
  41. - php-versions: '8.3'
  42. coverage: true
  43. name: php${{ matrix.php-versions }}-s3
  44. services:
  45. cache:
  46. image: ghcr.io/nextcloud/continuous-integration-redis:latest
  47. ports:
  48. - 6379:6379/tcp
  49. options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
  50. minio:
  51. image: bitnami/minio
  52. env:
  53. MINIO_ROOT_USER: nextcloud
  54. MINIO_ROOT_PASSWORD: bWluaW8tc2VjcmV0LWtleS1uZXh0Y2xvdWQ=
  55. MINIO_DEFAULT_BUCKETS: nextcloud
  56. ports:
  57. - "9000:9000"
  58. steps:
  59. - name: Checkout server
  60. uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
  61. with:
  62. submodules: true
  63. - name: Set up php ${{ matrix.php-versions }}
  64. uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
  65. with:
  66. php-version: ${{ matrix.php-versions }}
  67. # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
  68. extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
  69. coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
  70. ini-file: development
  71. env:
  72. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  73. - name: Set up Nextcloud
  74. env:
  75. OBJECT_STORE: s3
  76. OBJECT_STORE_KEY: nextcloud
  77. OBJECT_STORE_SECRET: bWluaW8tc2VjcmV0LWtleS1uZXh0Y2xvdWQ=
  78. run: |
  79. composer install
  80. cp tests/redis.config.php config/
  81. cp tests/preseed-config.php config/config.php
  82. ./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
  83. php -f tests/enable_all.php | grep -i -C9999 error && echo "Error during app setup" && exit 1 || exit 0
  84. - name: Wait for S3
  85. run: |
  86. sleep 10
  87. curl -f -m 1 --retry-connrefused --retry 10 --retry-delay 10 http://localhost:9000/minio/health/ready
  88. - name: PHPUnit
  89. env:
  90. OBJECT_STORE: s3
  91. OBJECT_STORE_KEY: nextcloud
  92. OBJECT_STORE_SECRET: bWluaW8tc2VjcmV0LWtleS1uZXh0Y2xvdWQ=
  93. run: composer run test -- --group PRIMARY-s3 ${{ matrix.coverage && ' --coverage-clover ./clover.xml' || '' }}
  94. - name: Upload code coverage
  95. if: ${{ !cancelled() && matrix.coverage }}
  96. uses: codecov/codecov-action@v4.1.1
  97. with:
  98. files: ./clover.xml
  99. flags: phpunit-s3
  100. - name: S3 logs
  101. if: always()
  102. run: |
  103. docker ps -a
  104. docker ps -aq | while read container ; do IMAGE=$(docker inspect --format='{{.Config.Image}}' $container); echo $IMAGE; docker logs $container; echo "\n\n" ; done
  105. s3-primary-summary:
  106. runs-on: ubuntu-latest-low
  107. needs: [changes,s3-primary-tests-minio]
  108. if: always()
  109. steps:
  110. - name: Summary status
  111. run: if ${{ needs.changes.outputs.src != 'false' && needs.s3-primary-tests-minio.result != 'success' }}; then exit 1; fi