-
Notifications
You must be signed in to change notification settings - Fork 19
105 lines (85 loc) · 3.04 KB
/
ci.yaml
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
name: CI
on:
- pull_request
- push
jobs:
analyse:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
- name: Check file permissions
run: ./dev-tools/check_file_permissions.sh
- name: Check trailing whitespaces
run: ./dev-tools/check_trailing_whitespaces.sh
- name: Install dependencies
run: composer update --no-progress
- name: Analyse
run: composer analyse
test:
strategy:
fail-fast: false
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
php-version: [ '7.4', '8.0' ]
include:
- os: ubuntu-latest
php-version: '7.2'
composer_flags: '--prefer-lowest'
- os: ubuntu-latest
php-version: '7.2'
- os: ubuntu-latest
php-version: '7.3'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get code coverage driver
uses: actions/[email protected]
id: coverage-driver
with:
script: 'return "${{ matrix.os }}" == "ubuntu-latest" && "${{ matrix.php-version }}" == "7.4" ? "pcov" : "none"'
result-encoding: string
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
ini-values: pcov.directory=$GITHUB_WORKSPACE
coverage: ${{ steps.coverage-driver.outputs.result }}
- name: Get Composer data directory
id: composer-data
run: echo '::set-output name=dir::$(composer config data-dir)'
- name: Cache Composer data
uses: actions/cache@v1
with:
path: ${{ steps.composer-data.outputs.dir }}
key: ${{ runner.os }}-composer-data-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-data-
- name: Get Composer cache directory
id: composer-cache
run: echo '::set-output name=dir::$(composer config cache-files-dir)'
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-cache-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-cache-
- name: Install dependencies
run: composer update --no-progress ${{ matrix.composer_flags }}
- name: Run tests
run: composer test -- --coverage-clover=./build/logs/clover.xml
- name: Upload coverage results to Coveralls
if: steps.coverage-driver.outputs.result != 'none'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer require --dev php-coveralls/php-coveralls --quiet
./vendor/bin/php-coveralls --verbose
- name: Run Infection
if: steps.coverage-driver.outputs.result != 'none'
run: composer infection