Skip to content

Commit

Permalink
chore: update testing workflow
Browse files Browse the repository at this point in the history
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
  • Loading branch information
SebastianKrupinski committed Oct 19, 2024
1 parent c5079f8 commit 7deff06
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 238 deletions.
238 changes: 0 additions & 238 deletions .github/workflows/phpunit.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# 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
6 changes: 6 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
comment: false
ignore:
- "tests"
- "lib/Vendor"

0 comments on commit 7deff06

Please sign in to comment.