|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - stable* |
| 9 | + |
| 10 | +jobs: |
| 11 | + unit-tests: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + php-versions: [7.3, 7.4] |
| 16 | + nextcloud-versions: ['stable21', 'stable22', 'stable23'] |
| 17 | + include: |
| 18 | + - php-versions: 7.4 |
| 19 | + nextcloud-versions: stable24 |
| 20 | + - php-versions: 8.0 |
| 21 | + nextcloud-versions: stable24 |
| 22 | + - php-versions: 7.4 |
| 23 | + nextcloud-versions: master |
| 24 | + - php-versions: 8.0 |
| 25 | + nextcloud-versions: master |
| 26 | + name: Nextcloud ${{ matrix.nextcloud-versions }} php${{ matrix.php-versions }} unit tests |
| 27 | + steps: |
| 28 | + - name: Set up php${{ matrix.php-versions }} |
| 29 | + uses: shivammathur/setup-php@master |
| 30 | + with: |
| 31 | + php-version: ${{ matrix.php-versions }} |
| 32 | + tools: composer:v1 |
| 33 | + extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,sqlite,xml,zip,gmp |
| 34 | + coverage: xdebug |
| 35 | + - name: Checkout Nextcloud |
| 36 | + run: git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloud-versions }} nextcloud |
| 37 | + - name: Install Nextcloud |
| 38 | + run: php -f nextcloud/occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database sqlite --database-pass='' |
| 39 | + - name: Checkout Viewer |
| 40 | + run: git clone https://github.com/nextcloud/viewer.git -b ${{ matrix.nextcloud-versions }} viewer |
| 41 | + working-directory: nextcloud/apps |
| 42 | + - name: Enable Viewer |
| 43 | + run: php -f nextcloud/occ app:enable viewer |
| 44 | + - name: Fix php-parser on stable20 incompatibility with phpunit 9.3+ |
| 45 | + if: ${{ matrix.nextcloud-versions == 'stable20' }} |
| 46 | + working-directory: nextcloud/3rdparty |
| 47 | + run: composer require nikic/php-parser:4.10 |
| 48 | + - name: Checkout Maps |
| 49 | + uses: actions/checkout@v3 |
| 50 | + with: |
| 51 | + path: nextcloud/apps/maps |
| 52 | + - name: Install dependencies |
| 53 | + working-directory: nextcloud/apps/maps |
| 54 | + run: composer install |
| 55 | + - name: Enable maps app |
| 56 | + working-directory: nextcloud |
| 57 | + run: php -f occ app:enable maps |
| 58 | + - name: Run tests |
| 59 | + working-directory: nextcloud/apps/maps |
| 60 | + run: composer run test:unit |
| 61 | + env: |
| 62 | + XDEBUG_MODE: coverage |
| 63 | + - name: Report coverage |
| 64 | + uses: codecov/codecov-action@v3.0.0 |
| 65 | + if: ${{ always() && matrix.nextcloud-versions == 'master' }} |
| 66 | + with: |
| 67 | + file: ./nextcloud/apps/maps/tests/clover.unit.xml |
| 68 | + flags: unittests |
| 69 | + fail_ci_if_error: true |
| 70 | + |
| 71 | + frontend-unit-test: |
| 72 | + runs-on: ubuntu-latest |
| 73 | + name: Front-end unit tests |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v3 |
| 76 | + - name: Set up Node |
| 77 | + uses: actions/setup-node@v3 |
| 78 | + with: |
| 79 | + node-version: 12.x |
| 80 | + - name: npm ci |
| 81 | + run: npm ci |
| 82 | + env: |
| 83 | + CI: true |
0 commit comments