Skip to content

chore: update testing workflow #10

chore: update testing workflow

chore: update testing workflow #10

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
env:
APP_NAME: contacts
jobs:
backend-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: php${{ matrix.php-versions }} branch ${{ matrix.nextcloud-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 App
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
path: nextcloud/apps/${{ env.APP_NAME }}
- name: Install dependencies
working-directory: nextcloud/apps/${{ env.APP_NAME }}
run: composer install
- name: Run tests
working-directory: nextcloud/apps/${{ env.APP_NAME }}
run: composer run test:unit
if: ${{ matrix.php-versions == '8.3' }}
env:
XDEBUG_MODE: coverage
- name: Run tests
working-directory: nextcloud/apps/${{ env.APP_NAME }}
run: composer run test:unit
if: ${{ matrix.php-versions != '8.3' }}
env:
XDEBUG_MODE: off
- name: Upload coverage to Codecov
if: ${{ matrix.php-versions != '8.3' }}
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: nextcloud/apps/${{ env.APP_NAME }}/clover.unit.xml
flags: php
fail_ci_if_error: ${{ !github.event.pull_request.head.repo.fork }}
verbose: true
summary:
runs-on: ubuntu-latest
needs:
- backend-unit-tests
if: always()
name: php-test-summary
steps:
- name: Unit test status
run: if ${{ needs.backend-unit-tests.result != 'success' && needs.backend-unit-tests.result != 'skipped' }}; then exit 1; fi