Skip to content

chore: update testing workflow #3

chore: update testing workflow

chore: update testing workflow #3

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@692973e3d937129bcbf40652eb9f2f61becf3332 # 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: Report coverage
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6
if: ${{ always() && matrix.php-versions == '8.3' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./nextcloud/apps/${{ env.APP_NAME }}/tests/clover.unit.xml
flags: unittests
fail_ci_if_error: ${{ !github.event.pull_request.head.repo.fork }}
summary:
runs-on: ubuntu-latest
needs:
- backend-unit-tests
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