-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (78 loc) · 2.6 KB
/
Copy pathphpunit.yml
File metadata and controls
98 lines (78 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# SPDX-FileCopyrightText: 2026 Etherpad contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Modeled on https://github.com/nextcloud/notes/blob/main/.github/workflows/phpunit.yml
# The test suite is stub-based (see tests/phpunit/bootstrap.php), so no real
# Nextcloud server is required — only a PHP toolchain with composer.
name: PHPUnit
on: pull_request
permissions:
contents: read
concurrency:
group: phpunit-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
src: ${{ steps.changes.outputs.src }}
steps:
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/phpunit.yml'
- 'composer.*'
- 'lib/**'
- 'tests/phpunit/**'
- 'phpunit.xml.dist'
phpunit:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
strategy:
fail-fast: false
matrix:
php-versions: ['8.2', '8.3', '8.4']
name: PHP ${{ matrix.php-versions }} unit tests
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
tools: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache composer dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php-versions }}-
- name: Install dependencies
run: composer install --no-progress --prefer-dist
- name: Run PHPUnit
run: composer test:phpunit
summary:
runs-on: ubuntu-latest
needs: phpunit
if: always()
name: phpunit-summary
steps:
- run: |
result="${{ needs.phpunit.result }}"
if [ "$result" != "success" ] && [ "$result" != "skipped" ]; then
exit 1
fi