|
| 1 | +# SPDX-FileCopyrightText: 2025 LibreCode coop and contributors |
| 2 | +# SPDX-License-Identifier: AGPL-3.0-or-later |
| 3 | + |
| 4 | +name: Behat SQLite |
| 5 | + |
| 6 | +on: pull_request |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: behat-sqlite-${{ github.head_ref || github.run_id }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + matrix: |
| 17 | + runs-on: almalinux-latest |
| 18 | + container: |
| 19 | + image: almalinux:9 |
| 20 | + outputs: |
| 21 | + php-version: ${{ steps.versions.outputs.php-available-list }} |
| 22 | + server-max: ${{ steps.versions.outputs.branches-max-list }} |
| 23 | + steps: |
| 24 | + - name: Checkout app |
| 25 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 26 | + with: |
| 27 | + persist-credentials: false |
| 28 | + |
| 29 | + - name: Get version matrix |
| 30 | + id: versions |
| 31 | + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 |
| 32 | + |
| 33 | + changes: |
| 34 | + runs-on: almalinux-latest |
| 35 | + container: |
| 36 | + image: almalinux:9 |
| 37 | + |
| 38 | + outputs: |
| 39 | + src: ${{ steps.changes.outputs.src}} |
| 40 | + |
| 41 | + steps: |
| 42 | + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 |
| 43 | + id: changes |
| 44 | + continue-on-error: true |
| 45 | + with: |
| 46 | + filters: | |
| 47 | + src: |
| 48 | + - '.github/workflows/**' |
| 49 | + - 'appinfo/**' |
| 50 | + - 'lib/**' |
| 51 | + - 'templates/**' |
| 52 | + - 'tests/**' |
| 53 | + - 'vendor/**' |
| 54 | + - 'vendor-bin/**' |
| 55 | + - '.php-cs-fixer.dist.php' |
| 56 | + - 'composer.json' |
| 57 | + - 'composer.lock' |
| 58 | +
|
| 59 | + behat-sqlite: |
| 60 | + runs-on: almalinux-latest |
| 61 | + container: |
| 62 | + image: almalinux:9 |
| 63 | + |
| 64 | + needs: [changes, matrix] |
| 65 | + if: needs.changes.outputs.src != 'false' |
| 66 | + |
| 67 | + strategy: |
| 68 | + matrix: |
| 69 | + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} |
| 70 | + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} |
| 71 | + |
| 72 | + name: SQLite PHP ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} |
| 73 | + |
| 74 | + services: |
| 75 | + mailhog: |
| 76 | + image: mailhog/mailhog |
| 77 | + ports: |
| 78 | + - 8025:8025/tcp |
| 79 | + - 1025:1025/tcp |
| 80 | + |
| 81 | + steps: |
| 82 | + - name: Set app env |
| 83 | + run: | |
| 84 | + # Split and keep last |
| 85 | + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV |
| 86 | +
|
| 87 | + - name: Install system dependencies |
| 88 | + run: sudo dnf check-update && sudo dnf install poppler-utils |
| 89 | + |
| 90 | + - name: Checkout server |
| 91 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 92 | + with: |
| 93 | + persist-credentials: false |
| 94 | + submodules: true |
| 95 | + repository: nextcloud/server |
| 96 | + ref: ${{ matrix.server-versions }} |
| 97 | + |
| 98 | + - name: Checkout app |
| 99 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 100 | + with: |
| 101 | + persist-credentials: false |
| 102 | + path: apps/${{ env.APP_NAME }} |
| 103 | + |
| 104 | + - name: Set up php ${{ matrix.php-versions }} |
| 105 | + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 |
| 106 | + with: |
| 107 | + php-version: ${{ matrix.php-versions }} |
| 108 | + tools: phpunit |
| 109 | + # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation |
| 110 | + extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite |
| 111 | + coverage: none |
| 112 | + ini-file: development |
| 113 | + env: |
| 114 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 115 | + |
| 116 | + - name: Check composer file existence |
| 117 | + id: check_composer |
| 118 | + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 |
| 119 | + with: |
| 120 | + files: apps/${{ env.APP_NAME }}/composer.json |
| 121 | + |
| 122 | + - name: Set up dependencies |
| 123 | + # Only run if phpunit config file exists |
| 124 | + if: steps.check_composer.outputs.files_exists == 'true' |
| 125 | + working-directory: apps/${{ env.APP_NAME }} |
| 126 | + run: | |
| 127 | + composer install --no-dev |
| 128 | + composer --working-dir=tests/integration install |
| 129 | +
|
| 130 | + - name: Prevent Nextcloud OCP outdated |
| 131 | + working-directory: apps/${{ env.APP_NAME }} |
| 132 | + run: make updateocp |
| 133 | + |
| 134 | + - name: Set up Nextcloud |
| 135 | + env: |
| 136 | + DB_PORT: 4444 |
| 137 | + run: | |
| 138 | + sudo echo "127.0.0.1 mailhog" | sudo tee -a /etc/hosts |
| 139 | + mkdir data |
| 140 | + ./occ maintenance:install \ |
| 141 | + --verbose \ |
| 142 | + --database=sqlite \ |
| 143 | + --database-name=nextcloud \ |
| 144 | + --database-host=127.0.0.1 \ |
| 145 | + --database-port=$DB_PORT \ |
| 146 | + --database-user=root \ |
| 147 | + --database-pass=rootpassword \ |
| 148 | + --admin-user admin \ |
| 149 | + --admin-pass admin |
| 150 | + ./occ --version |
| 151 | + ./occ app:enable --force ${{ env.APP_NAME }} |
| 152 | + git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/notifications apps/notifications |
| 153 | + ./occ app:enable --force notifications |
| 154 | + git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/activity apps/activity |
| 155 | + ./occ app:enable --force activity |
| 156 | + ./occ app:enable --force guests |
| 157 | + ./occ config:system:set mail_smtpport --value 1025 --type integer |
| 158 | + ./occ config:system:set mail_smtphost --value mailhog |
| 159 | + ./occ config:system:set allow_local_remote_servers --value true --type boolean |
| 160 | + ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean |
| 161 | +
|
| 162 | + - name: Run behat |
| 163 | + working-directory: apps/${{ env.APP_NAME }}/tests/integration |
| 164 | + env: |
| 165 | + BEHAT_ROOT_DIR: ../../../../ |
| 166 | + run: | |
| 167 | + export BEHAT_RUN_AS=runner |
| 168 | + export BEHAT_VERBOSE="$RUNNER_DEBUG" |
| 169 | + vendor/bin/behat -f junit -f pretty --colors |
| 170 | +
|
| 171 | + - name: Print logs |
| 172 | + if: always() |
| 173 | + run: | |
| 174 | + cat data/nextcloud.log |
| 175 | +
|
| 176 | + summary: |
| 177 | + permissions: |
| 178 | + contents: none |
| 179 | + runs-on: almalinux-latest |
| 180 | + container: |
| 181 | + image: almalinux:9 |
| 182 | + needs: [changes, behat-sqlite] |
| 183 | + |
| 184 | + if: always() |
| 185 | + |
| 186 | + name: behat-sqlite-summary |
| 187 | + |
| 188 | + steps: |
| 189 | + - name: Summary status |
| 190 | + run: if ${{ needs.changes.outputs.src != 'false' && needs.behat-sqlite.result != 'success' }}; then exit 1; fi |
0 commit comments