Skip to content

[main] Update nextcloud/ocp dependency #22

[main] Update nextcloud/ocp dependency

[main] Update nextcloud/ocp dependency #22

Workflow file for this run

# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Cypress
on: pull_request
concurrency:
group: cypress-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
# Adjust APP_NAME if your repository name is different
APP_NAME: ${{ github.event.repository.name }}
CYPRESS_baseUrl: http://localhost:8081/index.php
jobs:
changes:
runs-on: ubuntu-latest-low
outputs:
src: ${{ steps.changes.outputs.src}}
steps:
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/**'
- 'appinfo/**'
- 'lib/**'
- 'src/**'
- 'templates/**'
- 'babel.config.js'
- 'composer.json'
- 'composer.lock'
- 'cypress.config.js'
- 'package.json'
- 'package-lock.json'
- '**.js'
- '**.ts'
- '**.vue'
cypress:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
strategy:
fail-fast: false
matrix:
php-versions: ['8.3']
databases: ['sqlite']
server-versions: ['master']
include:
- php-versions: '7.3'
server-versions: 'stable22'
- php-versions: '7.4'
server-versions: 'stable23'
env:
PUPPETEER_SKIP_DOWNLOAD: true
name: runner ${{ matrix.containers }} (${{ matrix.server-versions }})
steps:
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
coverage: none
ini-file: development
- name: Checkout server
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: apps/${{ env.APP_NAME }}
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
id: versions
with:
fallbackNode: "^20"
fallbackNpm: "^10"
path: apps/${{ env.APP_NAME }}
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
- name: Setup NPM cache
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
cache: 'npm'
cache-dependency-path: apps/${{ env.APP_NAME }}/package-lock.json
# cypress will install dependencies
- name: Install node dependencies & build app
working-directory: apps/${{ env.APP_NAME }}
run: |
npm ci
TESTING=true npm run build --if-present
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=sqlite --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
./occ app:enable --force ${{ env.APP_NAME }}
- name: Run Nextcloud
run: php -S 0.0.0.0:8081 &
env:
PHP_CLI_SERVER_WORKERS: 3
- name: Run E2E cypress tests
uses: cypress-io/github-action@8d3918616d8ac34caa2b49afc8b408b6a872a6f5 # v6.7.1
with:
record: true
wait-on: '${{ env.CYPRESS_baseUrl }}'
working-directory: apps/${{ env.APP_NAME }}
config: video=false,defaultCommandTimeout=20000
tag: ${{ github.event_name }}
env:
# https://github.com/cypress-io/github-action/issues/124
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_ncVersion: ${{ matrix.server-versions }}
- name: Upload snapshots
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
if: failure()
with:
name: Screenshots.${{ matrix.server-versions }}-${{ matrix.containers }}
path: apps/${{ env.APP_NAME }}/cypress/screenshots/
retention-days: 5
- name: Upload NC logs
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
if: failure()
with:
name: nc_logs_${{ matrix.server-versions }}_${{ matrix.containers }}.log
path: data/nextcloud.log
retention-days: 5
summary:
runs-on: ubuntu-latest-low
needs: [changes, cypress]
if: always()
name: cypress-summary
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' ) }}; then exit 1; fi