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