-
Notifications
You must be signed in to change notification settings - Fork 10
134 lines (111 loc) · 4.05 KB
/
ci.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: CI
on: [pull_request, push]
env:
COMPOSER_COMMAND: composer update
COMPOSER_ARGS: --no-interaction --no-progress
jobs:
Dependencies:
runs-on: ubuntu-latest
name: Check Dependencies
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer-require-checker
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install $COMPOSER_ARGS
- name: Run require check
run: composer-require-checker
Coding-Standards:
runs-on: ubuntu-latest
continue-on-error: true #TODO: Remove this once we get to a passing baseline
name: Check Coding Standards
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: cs2pr
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install $COMPOSER_ARGS
- name: Run coding standards check
run: ./vendor/bin/phpcs -q --report=full --report-checkstyle=checkstyle-report.xml
- name: Annotate pull request
if: ${{ github.event_name == 'pull_request' }}
run: cs2pr checkstyle-report.xml
Tests:
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0']
deps: [lowest, highest, locked]
include:
- deps: lowest
deps-arg: --prefer-lowest
- deps: locked
composer-command: composer install
hash-file: '**/composer.lock'
runs-on: ubuntu-latest
name: Test on PHP ${{ matrix.php-versions }} with deps ${{ matrix.deps }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: pcov
env:
update: true
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: >-
${{ format('{0}-composer-{1}-{2}',
runner.os,
matrix.deps,
hashFiles(matrix.hash-file || '**/composer.json')
) }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.deps }}-
- name: Install ${{ matrix.deps }} dependencies
env:
COMPOSER_COMMAND: ${{ matrix.composer-command || env.COMPOSER_COMMAND }}
run: $COMPOSER_COMMAND $COMPOSER_ARGS ${{ matrix.deps-arg }}
- name: Run tests
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
- name: Upload coverage to Scrutinizer
if: ${{ matrix.php-versions != '8.0' }}
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover