Skip to content

Build(deps): Bump actions/cache from 3.3.3 to 4.0.0 #1865

Build(deps): Bump actions/cache from 3.3.3 to 4.0.0

Build(deps): Bump actions/cache from 3.3.3 to 4.0.0 #1865

Workflow file for this run

name: Cypress
on: pull_request
permissions:
contents: read
concurrency:
group: cypress-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
APP_NAME: collectives
CYPRESS_baseUrl: http://localhost:8081/index.php
jobs:
changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.src}}
steps:
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/**'
- 'appinfo/**'
- 'css/**'
- 'lib/**'
- 'skeleton/**'
- 'src/**'
- 'templates/**'
- 'babel.config.js'
- 'composer.json'
- 'composer.lock'
- 'cypress.config.js'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- '**.js'
- '**.ts'
- '**.vue'
init:
runs-on: ubuntu-22.04
needs: changes
if: needs.changes.outputs.src != 'false'
outputs:
nodeVersion: ${{ steps.versions.outputs.nodeVersion }}
npmVersion: ${{ steps.versions.outputs.npmVersion }}
strategy:
matrix:
server-versions: ['stable25', 'stable27', 'master']
steps:
- name: Checkout server
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout circles app
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: nextcloud/circles
path: apps/circles
ref: ${{ matrix.server-versions }}
- name: Checkout files_pdfviewer app
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: nextcloud/files_pdfviewer
path: apps/files_pdfviewer
ref: ${{ matrix.server-versions }}
- name: Register text Git reference
run: |
text_app_ref="$(if [ "${{ matrix.server-versions }}" = "master" ]; then echo -n "main"; else echo -n "${{ matrix.server-versions }}"; fi)"
echo "text_app_ref=$text_app_ref" >> $GITHUB_ENV
- name: Checkout text app
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: nextcloud/text
path: apps/text
ref: ${{ env.text_app_ref }}
- name: Checkout viewer app
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: nextcloud/viewer
path: apps/viewer
ref: ${{ matrix.server-versions }}
- name: Checkout app
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: apps/${{ env.APP_NAME }}
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
id: versions
with:
fallbackNode: '^20'
fallbackNpm: '^9'
path: apps/${{ env.APP_NAME }}
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v3
with:
cache: 'npm'
node-version: ${{ steps.versions.outputs.nodeVersion }}
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
- name: Install dependencies & build
working-directory: apps/${{ env.APP_NAME }}
run: |
npm ci
npm run build --if-present
- name: Save context
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
key: cypress-context-${{ matrix.server-versions }}-${{ github.run_id }}
path: ./
cypress:
runs-on: ubuntu-22.04
needs: [changes, init]
if: needs.changes.outputs.src != 'false'
strategy:
fail-fast: false
matrix:
node-version: [20]
containers: [1, 2, 3]
php-versions: ['8.0', '8.2']
databases: ['sqlite']
server-versions: ['stable25', 'stable27', 'master']
# Only use cypress cloud for PRs
use-cypress-cloud:
- ${{ vars.USE_CYPRESS_CLOUD && !!github.head_ref }}
exclude:
- php-versions: '8.0'
server-versions: 'stable27'
- php-versions: '8.0'
server-versions: 'master'
- php-versions: '8.2'
server-versions: 'stable25'
# Only use one container if we are not using the cypress cloud.
- use-cypress-cloud: false
containers: 2
- use-cypress-cloud: false
containers: 3
steps:
- name: Restore context
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
fail-on-cache-miss: true
key: cypress-context-${{ matrix.server-versions }}-${{ github.run_id }}
path: ./
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v3
with:
cache: 'npm'
node-version: ${{ steps.versions.outputs.nodeVersion }}
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # 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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install composer dependencies
working-directory: apps/${{ env.APP_NAME }}
run: composer i --no-dev
- 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 config:system:set --value="http://localhost:8081" -- overwrite.cli.url
./occ app:enable --force contacts
./occ app:enable --force files_pdfviewer
./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: Add Nextcloud users and a collective for full-text search
run: |
for user in alice bob jane john; do \
OC_PASS="$user" ./occ user:add --password-from-env "$user"; \
done
./occ group:add "Bobs Group"
for user in bob jane; do \
OC_PASS="$user" ./occ group:adduser "Bobs Group" "$user"; \
done
./occ collectives:create SearchTest --owner=bob
./occ collectives:index
- name: Cypress run
uses: cypress-io/github-action@v6
with:
record: '${{ !!matrix.use-cypress-cloud }}'
parallel: '${{ !!matrix.use-cypress-cloud }}'
group: "${{ !!matrix.use-cypress-cloud && format('Nextcloud {0}', matrix.server-versions) || '' }}"
wait-on: '${{ env.CYPRESS_baseUrl }}'
working-directory: apps/${{ env.APP_NAME }}
config: video=false,defaultCommandTimeout=20000
tag: "${{ !!matrix.use-cypress-cloud && 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 test failure screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: Screenshots.${{ matrix.server-versions }}-${{ matrix.containers }}
path: apps/${{ env.APP_NAME }}/cypress/screenshots/
retention-days: 5
- name: Upload nextcloud logs
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.server-versions }}-${{ matrix.containers }}.log
path: data/nextcloud.log
retention-days: 5
summary:
permissions:
contents: none
runs-on: ubuntu-latest
needs: [changes, init, cypress]
if: always()
name: cypress-summary
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && (needs.init.result != 'success' || ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' )) }}; then exit 1; fi