-
Notifications
You must be signed in to change notification settings - Fork 6
94 lines (75 loc) · 2.06 KB
/
main.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
name: build and test
on: [push, pull_request, workflow_dispatch]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version: ['7.0', '7.4', '8.0', '8.2']
max-parallel: 2
steps:
- uses: actions/checkout@v3
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: php-${{ matrix.version }}-${{ github.ref }}
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.version }}
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: composer install --prefer-dist --no-progress
test:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
version: ['7.0', '7.4', '8.0', '8.2']
max-parallel: 1
steps:
- uses: actions/checkout@v3
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.version }}
coverage: xdebug2
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: php-${{ matrix.version }}-${{ github.ref }}
- name: Run test suite
run: php vendor/bin/phpunit --coverage-clover=coverage.xml --whitelist=./src ./tests
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: coverage.xml
retention-days: 1
coverage_upload:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download code coverage results
uses: actions/download-artifact@v3
with:
name: code-coverage-report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
verbose: true