|
| 1 | +# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | + |
| 4 | +name: Playwright tests |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + - master |
| 12 | + - stable* |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +jobs: |
| 18 | + changes: |
| 19 | + runs-on: ubuntu-latest-low |
| 20 | + |
| 21 | + outputs: |
| 22 | + src: ${{ steps.changes.outputs.src}} |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 |
| 26 | + id: changes |
| 27 | + continue-on-error: true |
| 28 | + with: |
| 29 | + filters: | |
| 30 | + src: |
| 31 | + - '.github/workflows/**' |
| 32 | + - 'src/**' |
| 33 | + - 'appinfo/info.xml' |
| 34 | + - 'package.json' |
| 35 | + - 'package-lock.json' |
| 36 | + - 'tsconfig.json' |
| 37 | + - '**.js' |
| 38 | + - '**.ts' |
| 39 | + - '**.vue' |
| 40 | +
|
| 41 | + playwright-test: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + name: Run Playwright tests |
| 44 | + permissions: |
| 45 | + contents: read |
| 46 | + pull-requests: read |
| 47 | + |
| 48 | + needs: changes |
| 49 | + if: needs.changes.outputs.src != 'false' |
| 50 | + |
| 51 | + strategy: |
| 52 | + fail-fast: false |
| 53 | + matrix: |
| 54 | + php-versions: ['8.2'] |
| 55 | + server-versions: ['master'] |
| 56 | + notifications-versions: ['master'] |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Set app env |
| 60 | + run: | |
| 61 | + # Split and keep last |
| 62 | + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV |
| 63 | +
|
| 64 | + - name: Checkout server |
| 65 | + if: ${{ matrix.branches != 'main' }} |
| 66 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 67 | + with: |
| 68 | + persist-credentials: false |
| 69 | + submodules: true |
| 70 | + repository: nextcloud/server |
| 71 | + ref: ${{ matrix.server-versions }} |
| 72 | + |
| 73 | + - name: Checkout app |
| 74 | + id: checkout |
| 75 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 76 | + with: |
| 77 | + persist-credentials: false |
| 78 | + path: apps/${{ env.APP_NAME }} |
| 79 | + |
| 80 | + - name: Checkout notifications app |
| 81 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 82 | + with: |
| 83 | + persist-credentials: false |
| 84 | + repository: nextcloud/notifications |
| 85 | + path: apps/notifications |
| 86 | + ref: ${{ matrix.notifications-versions }} |
| 87 | + |
| 88 | + - name: Set up php ${{ matrix.php-versions }} |
| 89 | + uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2.35.5 |
| 90 | + with: |
| 91 | + php-version: ${{ matrix.php-versions }} |
| 92 | + # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation |
| 93 | + extensions: apcu, bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql, sqlite, pdo_sqlite |
| 94 | + coverage: none |
| 95 | + ini-file: development |
| 96 | + # Temporary workaround for missing pcntl_* in PHP 8.3: ini-values: apc.enable_cli=on |
| 97 | + ini-values: apc.enable_cli=on, disable_functions= |
| 98 | + env: |
| 99 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 100 | + |
| 101 | + - name: Set up production dependencies |
| 102 | + working-directory: apps/${{ env.APP_NAME }} |
| 103 | + run: composer i --no-dev |
| 104 | + |
| 105 | + - name: Set up Nextcloud |
| 106 | + env: |
| 107 | + DB_PORT: 4444 |
| 108 | + run: | |
| 109 | + mkdir data |
| 110 | + ./occ maintenance:install --verbose --database=mysql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin |
| 111 | + ./occ config:system:set debug --value=true --type=boolean |
| 112 | + ./occ config:system:set hashing_default_password --value=true --type=boolean |
| 113 | + ./occ config:system:set memcache.local --value="\\OC\\Memcache\\APCu" |
| 114 | + ./occ config:system:set memcache.distributed --value="\\OC\\Memcache\\APCu" |
| 115 | + ./occ app:enable --force ${{ env.APP_NAME }} |
| 116 | + ./occ app:enable --force notifications |
| 117 | +
|
| 118 | + - name: Read package.json node and npm engines version |
| 119 | + if: steps.checkout.outcome == 'success' |
| 120 | + uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 |
| 121 | + id: versions |
| 122 | + with: |
| 123 | + fallbackNode: '^20' |
| 124 | + fallbackNpm: '^10' |
| 125 | + |
| 126 | + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} |
| 127 | + if: steps.checkout.outcome == 'success' |
| 128 | + uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 |
| 129 | + with: |
| 130 | + node-version: ${{ steps.versions.outputs.nodeVersion }} |
| 131 | + |
| 132 | + - name: Set up npm ${{ steps.versions.outputs.npmVersion }} |
| 133 | + if: steps.checkout.outcome == 'success' |
| 134 | + run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}' |
| 135 | + |
| 136 | + - name: Install dependencies & generate types |
| 137 | + if: steps.checkout.outcome == 'success' |
| 138 | + working-directory: apps/${{ env.APP_NAME }} |
| 139 | + env: |
| 140 | + CYPRESS_INSTALL_BINARY: 0 |
| 141 | + PUPPETEER_SKIP_DOWNLOAD: true |
| 142 | + run: | |
| 143 | + npm ci |
| 144 | + npx playwright install |
| 145 | + npm run test:e2e |
0 commit comments