-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (74 loc) · 2.69 KB
/
phpunit.yml
File metadata and controls
86 lines (74 loc) · 2.69 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
name: PHPUnit Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
defaults:
run:
working-directory: php-example
jobs:
test:
name: PHPUnit + Clover Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
coverage: pcov
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@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('php-example/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Create reports directory
run: mkdir -p reports
- name: Run tests with coverage
run: |
vendor/bin/phpunit \
--coverage-clover reports/clover.xml \
--coverage-html reports/htmlcov \
--log-junit reports/phpunit-results.xml
continue-on-error: true
# Upload PHPUnit test results to Gaffer
# Skip on Dependabot PRs (no access to secrets)
- name: Upload PHPUnit results to Gaffer
if: always() && github.actor != 'dependabot[bot]'
uses: gaffer-sh/gaffer-uploader@v0.4.0
with:
gaffer_upload_token: ${{ secrets.GAFFER_UPLOAD_TOKEN }}
report_path: php-example/reports/phpunit-results.xml
commit_sha: ${{ github.event.pull_request.head.sha || github.sha }}
branch: ${{ github.head_ref || github.ref_name }}
test_framework: phpunit
test_suite: phpunit-results
# Upload Clover coverage to Gaffer
- name: Upload Clover coverage to Gaffer
if: always() && github.actor != 'dependabot[bot]'
uses: gaffer-sh/gaffer-uploader@v0.4.0
with:
gaffer_upload_token: ${{ secrets.GAFFER_UPLOAD_TOKEN }}
report_path: php-example/reports/clover.xml
commit_sha: ${{ github.event.pull_request.head.sha || github.sha }}
branch: ${{ github.head_ref || github.ref_name }}
test_framework: phpunit
test_suite: phpunit-coverage
# Store artifacts for parser development
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: phpunit-reports-${{ github.sha }}
path: php-example/reports/
retention-days: 7