Skip to content

fix(deps): Apply npm audit fix #16885

fix(deps): Apply npm audit fix

fix(deps): Apply npm audit fix #16885

Workflow file for this run

# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Test
on: pull_request
permissions:
contents: read
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']
nextcloud-versions: ['master', 'stable30']
include:
- php-versions: '8.4'
nextcloud-versions: 'master'
name: Nextcloud ${{ matrix.nextcloud-versions }} php${{ matrix.php-versions }} unit tests
steps:
- name: Set up Nextcloud env
uses: ChristophWurst/setup-nextcloud@fc0790385c175d97e88a7cb0933490de6e990374 # v0.3.2
with:
nextcloud-version: ${{ matrix.nextcloud-versions }}
php-version: ${{ matrix.php-versions }}
php-coverage: 'xdebug'
patch-php-version-check: ${{ matrix.php-versions == '8.4' }}
node-version: 'false'
install: true
- name: Checkout Mail
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
path: nextcloud/apps/mail
fetch-depth: 2
- name: Install dependencies
working-directory: nextcloud/apps/mail
run: composer install
- name: Run tests
working-directory: nextcloud/apps/mail
run: composer run test:unit
if: ${{ matrix.php-versions == '8.3' }}
env:
XDEBUG_MODE: coverage
- name: Run tests
working-directory: nextcloud/apps/mail
run: composer run test:unit
if: ${{ matrix.php-versions != '8.3' }}
env:
XDEBUG_MODE: off
- name: Report coverage
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
if: ${{ always() && matrix.php-versions == '8.3' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
working-directory: nextcloud/apps/mail
file: tests/clover.unit.xml
flags: unittests
fail_ci_if_error: ${{ !github.event.pull_request.head.repo.fork }}
verbose: true
integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.3']
nextcloud-versions: ['master']
db: ['sqlite', 'mysql', 'pgsql']
cache: ['nocache']
include:
- php-versions: 8.1
nextcloud-versions: master
db: 'sqlite'
cache: 'redis'
- php-versions: 8.2
nextcloud-versions: master
db: 'mysql'
cache: 'redis'
- php-versions: 8.2
nextcloud-versions: stable30
db: 'mysql'
cache: 'redis'
name: ${{ matrix.nextcloud-versions }} w/ php${{ matrix.php-versions }}-${{ matrix.db }}-${{ matrix.cache }} integration tests
services:
mail-service:
image: ghcr.io/christophwurst/docker-imap-devel:latest
env:
MAILNAME: mail.domain.tld
MAIL_ADDRESS: [email protected]
MAIL_PASS: mypassword
ports:
- 25:25
- 143:143
- 993:993
- 4190:4190
mysql-service:
image: ghcr.io/nextcloud/continuous-integration-mariadb-10.11:latest
env:
MYSQL_ROOT_PASSWORD: my-secret-pw
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: nextcloud
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
postgres-service:
image: ghcr.io/nextcloud/continuous-integration-postgres-15:latest
env:
POSTGRES_USER: nextcloud
POSTGRES_DB: nextcloud
POSTGRES_PASSWORD: nextcloud
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: ghcr.io/nextcloud/continuous-integration-redis:latest
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Set up Nextcloud env
uses: ChristophWurst/setup-nextcloud@fc0790385c175d97e88a7cb0933490de6e990374 # v0.3.2
with:
nextcloud-version: ${{ matrix.nextcloud-versions }}
php-version: ${{ matrix.php-versions }}
php-coverage: 'xdebug'
patch-php-version-check: ${{ matrix.php-versions == '8.4' }}
install: true
database: ${{ matrix.db }}
node-version: 'false'
- name: Configure caching
if: ${{ matrix.cache == 'redis' }}
run: |
php -f nextcloud/occ config:system:set memcache.local --value='\OC\Memcache\Redis'
php -f nextcloud/occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
- name: Checkout Mail
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
path: nextcloud/apps/mail
fetch-depth: 2
- name: Install dependencies
working-directory: nextcloud/apps/mail
run: composer install
- name: Patch version check for nightly PHP
if: ${{ matrix.php-versions == '8.3' }}
run: sed -i 's/max-version="8.3"/max-version="8.4"/' nextcloud/apps/mail/appinfo/info.xml
- name: Install Mail
run: php -f nextcloud/occ app:enable -f mail
- name: Configure Nextcloud for testing
run: |
php -f nextcloud/occ config:system:set debug --type bool --value true
php -f nextcloud/occ config:system:set app.mail.verify-tls-peer --type bool --value false
- name: Enable slow mysql query logs
if: ${{ matrix.db == 'mysql' }}
run: |
echo "SET GLOBAL log_queries_not_using_indexes = 1;" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
echo "SET GLOBAL slow_query_log=1;" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
echo "SET GLOBAL log_output = 'table';" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
- name: Run tests
working-directory: nextcloud/apps/mail
if: ${{ matrix.db == 'mysql' }}
run: composer run test:integration
env:
XDEBUG_MODE: coverage
- name: Run tests
working-directory: nextcloud/apps/mail
if: ${{ matrix.db != 'mysql' }}
run: composer run test:integration
env:
XDEBUG_MODE: off
- name: Read slow queries
if: ${{ always() }}
run: echo "SELECT * FROM mysql.slow_log WHERE sql_text LIKE '%oc_mail%' AND sql_text NOT LIKE '%information_schema%'" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
- name: Print debug logs
if: ${{ always() }}
run: cat nextcloud/data/horde_*.log
- name: Report coverage
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
if: ${{ always() && matrix.db == 'mysql' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
working-directory: nextcloud/apps/mail
file: tests/clover.integration.xml
flags: integrationtests
fail_ci_if_error: ${{ !github.event.pull_request.head.repo.fork }}
verbose: true
frontend-unit-test:
runs-on: ubuntu-latest
name: Front-end unit tests
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
id: versions
with:
fallbackNode: '^14'
fallbackNpm: '^7'
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
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: npm install
run: npm install
- name: run tests
run: npm run test:unit
env:
CI: true
summary:
runs-on: ubuntu-latest
needs:
- unit-tests
- integration-tests
- frontend-unit-test
if: always()
name: test-summary
steps:
- name: Unit test status
run: if ${{ needs.unit-tests.result != 'success' && needs.unit-tests.result != 'skipped' }}; then exit 1; fi
- name: Integration test status
run: if ${{ needs.integration-tests.result != 'success' && needs.integration-tests.result != 'skipped' }}; then exit 1; fi
- name: Frontend unit test status
run: if ${{ needs.frontend-unit-test.result != 'success' && needs.frontend-unit-test.result != 'skipped' }}; then exit 1; fi