-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 1.93 KB
/
test.yml
File metadata and controls
76 lines (65 loc) · 1.93 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
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: PHP ${{ matrix.php }} Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.4']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php }} with PCOV
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
tools: composer:v2
ini-values: |
pcov.enabled=1
pcov.directory=.
pcov.exclude=*/vendor/*,*/tests/*
- name: Validate composer.json
run: composer validate --strict
- name: Install dependencies (cached)
uses: ramsey/composer-install@v3
with:
composer-options: --no-interaction --prefer-dist --no-progress
- name: Make report directories
run: mkdir -p build/logs coverage/html
- name: Run PHPUnit with coverage (PCOV)
run: |
vendor/bin/phpunit \
--coverage-clover build/logs/clover.xml \
--coverage-html coverage/html \
--log-junit build/logs/junit.xml \
--colors=always
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: build/logs/clover.xml
flags: unittests
fail_ci_if_error: true
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
files: build/logs/junit.xml
flags: unittests
fail_ci_if_error: true
- name: Upload test artifacts (JUnit & HTML & Clover)
if: always()
uses: actions/upload-artifact@v4
with:
name: php-${{ matrix.php }}-test-artifacts
path: |
build/logs/
coverage/html/
retention-days: 7