|
| 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 | + |
| 13 | +env: |
| 14 | + APP_NAME: files_external |
| 15 | + |
| 16 | +jobs: |
| 17 | + s3-external-tests-minio: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + strategy: |
| 21 | + # do not stop on another job's failure |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + php-versions: ['7.4', '8.0'] |
| 25 | + |
| 26 | + name: php${{ matrix.php-versions }}-minio |
| 27 | + |
| 28 | + services: |
| 29 | + minio: |
| 30 | + env: |
| 31 | + MINIO_ACCESS_KEY: minio |
| 32 | + MINIO_SECRET_KEY: minio123 |
| 33 | + image: bitnami/minio:2021.10.6 |
| 34 | + ports: |
| 35 | + - "9000:9000" |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Checkout server |
| 39 | + uses: actions/checkout@v2 |
| 40 | + with: |
| 41 | + submodules: true |
| 42 | + |
| 43 | + - name: Set up php ${{ matrix.php-versions }} |
| 44 | + uses: shivammathur/setup-php@v2 |
| 45 | + with: |
| 46 | + php-version: ${{ matrix.php-versions }} |
| 47 | + tools: phpunit |
| 48 | + extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, zip, gd |
| 49 | + |
| 50 | + - name: Set up Nextcloud |
| 51 | + run: | |
| 52 | + mkdir data |
| 53 | + ./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 |
| 54 | + ./occ app:enable --force ${{ env.APP_NAME }} |
| 55 | + php -S localhost:8080 & |
| 56 | + - name: PHPUnit |
| 57 | + run: | |
| 58 | + echo "<?php return ['run' => true,'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 |
| 59 | + phpunit --configuration tests/phpunit-autotest-external.xml apps/files_external/tests/Storage/Amazons3Test.php |
| 60 | + phpunit --configuration tests/phpunit-autotest-external.xml apps/files_external/tests/Storage/VersionedAmazonS3Test.php |
| 61 | + - name: S3 logs |
| 62 | + if: always() |
| 63 | + run: | |
| 64 | + docker ps -a |
| 65 | + docker logs $(docker ps -aq) |
| 66 | + s3-external-tests-localstack: |
| 67 | + runs-on: ubuntu-latest |
| 68 | + |
| 69 | + strategy: |
| 70 | + # do not stop on another job's failure |
| 71 | + fail-fast: false |
| 72 | + matrix: |
| 73 | + php-versions: ['7.4', '8.0'] |
| 74 | + |
| 75 | + name: php${{ matrix.php-versions }}-localstack |
| 76 | + |
| 77 | + services: |
| 78 | + minio: |
| 79 | + env: |
| 80 | + SERVICES: s3 |
| 81 | + DEBUG: 1 |
| 82 | + image: localstack/localstack:0.12.7 |
| 83 | + ports: |
| 84 | + - "4566:4566" |
| 85 | + |
| 86 | + steps: |
| 87 | + - name: Checkout server |
| 88 | + uses: actions/checkout@v2 |
| 89 | + with: |
| 90 | + submodules: true |
| 91 | + |
| 92 | + - name: Set up php ${{ matrix.php-versions }} |
| 93 | + uses: shivammathur/setup-php@v2 |
| 94 | + with: |
| 95 | + php-version: ${{ matrix.php-versions }} |
| 96 | + tools: phpunit |
| 97 | + extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, zip, gd |
| 98 | + |
| 99 | + - name: Set up Nextcloud |
| 100 | + run: | |
| 101 | + mkdir data |
| 102 | + ./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 |
| 103 | + ./occ app:enable --force ${{ env.APP_NAME }} |
| 104 | + php -S localhost:8080 & |
| 105 | + - name: PHPUnit |
| 106 | + run: | |
| 107 | + 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 |
| 108 | + phpunit --configuration tests/phpunit-autotest-external.xml apps/files_external/tests/Storage/Amazons3Test.php |
| 109 | + phpunit --configuration tests/phpunit-autotest-external.xml apps/files_external/tests/Storage/VersionedAmazonS3Test.php |
| 110 | + - name: S3 logs |
| 111 | + if: always() |
| 112 | + run: | |
| 113 | + docker ps -a |
| 114 | + docker logs $(docker ps -aq) |
| 115 | +
|
| 116 | + s3-external-summary: |
| 117 | + runs-on: ubuntu-latest |
| 118 | + needs: [s3-external-tests-minio, s3-external-tests-localstack] |
| 119 | + |
| 120 | + if: always() |
| 121 | + |
| 122 | + steps: |
| 123 | + - name: Summary status |
| 124 | + run: if ${{ needs.s3-external-tests-minio.result != 'success' }} || ${{ needs.s3-external-tests-localstack.result != 'success' }}; then exit 1; fi |
0 commit comments