s3-external.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. name: S3 External storage
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - stable*
  7. paths:
  8. - 'apps/files_external/**'
  9. pull_request:
  10. paths:
  11. - 'apps/files_external/**'
  12. env:
  13. APP_NAME: files_external
  14. jobs:
  15. s3-external-tests-minio:
  16. runs-on: ubuntu-latest
  17. if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
  18. strategy:
  19. # do not stop on another job's failure
  20. fail-fast: false
  21. matrix:
  22. php-versions: ['8.0', '8.1']
  23. name: php${{ matrix.php-versions }}-minio
  24. services:
  25. minio:
  26. env:
  27. MINIO_ACCESS_KEY: minio
  28. MINIO_SECRET_KEY: minio123
  29. image: bitnami/minio:2021.10.6
  30. ports:
  31. - "9000:9000"
  32. steps:
  33. - name: Checkout server
  34. uses: actions/checkout@v3
  35. with:
  36. submodules: true
  37. - name: Set up php ${{ matrix.php-versions }}
  38. uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d #v2.25.2
  39. with:
  40. php-version: ${{ matrix.php-versions }}
  41. tools: phpunit:9
  42. extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
  43. env:
  44. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  45. - name: Set up Nextcloud
  46. run: |
  47. mkdir data
  48. ./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
  49. ./occ app:enable --force ${{ env.APP_NAME }}
  50. php -S localhost:8080 &
  51. - name: PHPUnit
  52. run: |
  53. echo "<?php return ['run' => true, 'secret' => 'actually-not-secret', 'passwordsalt' => 'actually-not-secret', 'hostname' => 'localhost','key' => 'minio','secret' => 'minio123', 'bucket' => 'bucket', 'port' => 9000, 'use_ssl' => false, 'autocreate' => true, 'use_path_style' => true];" > apps/${{ env.APP_NAME }}/tests/config.amazons3.php
  54. phpunit --configuration tests/phpunit-autotest-external.xml apps/files_external/tests/Storage/Amazons3Test.php
  55. phpunit --configuration tests/phpunit-autotest-external.xml apps/files_external/tests/Storage/VersionedAmazonS3Test.php
  56. - name: S3 logs
  57. if: always()
  58. run: |
  59. docker ps -a
  60. docker logs $(docker ps -aq)
  61. s3-external-tests-localstack:
  62. runs-on: ubuntu-latest
  63. if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
  64. strategy:
  65. # do not stop on another job's failure
  66. fail-fast: false
  67. matrix:
  68. php-versions: ['8.0', '8.1']
  69. name: php${{ matrix.php-versions }}-localstack
  70. services:
  71. minio:
  72. env:
  73. SERVICES: s3
  74. DEBUG: 1
  75. image: localstack/localstack:0.12.7
  76. ports:
  77. - "4566:4566"
  78. steps:
  79. - name: Checkout server
  80. uses: actions/checkout@v3
  81. with:
  82. submodules: true
  83. - name: Set up php ${{ matrix.php-versions }}
  84. uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d #v2.25.2
  85. with:
  86. php-version: ${{ matrix.php-versions }}
  87. tools: phpunit:9
  88. extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
  89. env:
  90. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  91. - name: Set up Nextcloud
  92. run: |
  93. mkdir data
  94. ./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
  95. ./occ app:enable --force ${{ env.APP_NAME }}
  96. php -S localhost:8080 &
  97. - name: PHPUnit
  98. run: |
  99. echo "<?php return ['run' => true,'hostname' => 'localhost','key' => 'ignored','secret' => 'ignored', 'bucket' => 'bucket', 'port' => 4566, 'use_ssl' => false, 'autocreate' => true, 'use_path_style' => true];" > apps/${{ env.APP_NAME }}/tests/config.amazons3.php
  100. phpunit --configuration tests/phpunit-autotest-external.xml apps/files_external/tests/Storage/Amazons3Test.php
  101. phpunit --configuration tests/phpunit-autotest-external.xml apps/files_external/tests/Storage/VersionedAmazonS3Test.php
  102. - name: S3 logs
  103. if: always()
  104. run: |
  105. docker ps -a
  106. docker logs $(docker ps -aq)
  107. s3-external-summary:
  108. runs-on: ubuntu-latest
  109. needs: [s3-external-tests-minio, s3-external-tests-localstack]
  110. if: always()
  111. steps:
  112. - name: Summary status
  113. run: if ${{ needs.s3-external-tests-minio.result != 'success' }} || ${{ needs.s3-external-tests-localstack.result != 'success' }}; then exit 1; fi