s3-external.yml 4.5 KB

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