-
Notifications
You must be signed in to change notification settings - Fork 6
103 lines (87 loc) · 2.88 KB
/
unit-tests.yml
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
99
100
101
102
103
name: PHPUnit
on:
push:
pull_request:
defaults:
run:
shell: bash
jobs:
tests:
name: Unit Tests
runs-on: ubuntu-latest
env:
extensions: amqp apcu gettext igbinary intl mbstring memcached xdebug
strategy:
matrix:
include:
- php: '8.0'
phpunit: '9.6'
phpunit_config: 'phpunit.xml'
- php: '8.1'
phpunit: '9.6'
phpunit_config: 'phpunit.xml'
- php: '8.2'
phpunit: '9.6'
phpunit_config: 'phpunit.xml'
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-{{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
- name: Setup Code Climate
uses: remarkablemark/setup-codeclimate@v2
if: ${{ github.event_name == 'push' && matrix.php == '8.2' }}
- name: Setup PHP
uses: php-actions/composer@v6
with:
memory_limit: 256M
php_version: "${{ matrix.php }}"
php_extensions: "${{ env.extensions }}"
- name: CodeClimate Before Build
if: ${{ github.event_name == 'push' && matrix.php == '8.2' }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: cc-test-reporter before-build
- name: Run Tests
uses: php-actions/phpunit@v3
env:
XDEBUG_MODE: coverage
with:
memory_limit: 256M
configuration: "${{ matrix.phpunit_config }}"
version: "${{ matrix.phpunit }}"
coverage_clover: "clover.xml"
coverage_text: true
php_version: "${{ matrix.php }}"
php_extensions: "${{ env.extensions }}"
- name: Fix file paths in clover.xml
shell: bash
run: |
sed -i 's#/app#'"$PWD"'#g' clover.xml
- name: CodeClimate After Build
if: ${{ github.event_name == 'push' && matrix.php == '8.2' }}
env:
COVERAGE_FILE: clover.xml
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: cc-test-reporter after-build -t clover
- name: Make code coverage badge
if: ${{ github.event_name == 'push' && matrix.php == '8.2' }}
uses: timkrase/[email protected]
with:
coverage_badge_path: output/coverage.svg
push_badge: false
- name: Push code coverage badge
if: ${{ github.event_name == 'push' && matrix.php == '8.2' }}
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./output
publish_branch: gh-images
github_token: ${{ secrets.GITHUB_TOKEN }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'