-
Notifications
You must be signed in to change notification settings - Fork 4
100 lines (85 loc) · 2.85 KB
/
build.yml
File metadata and controls
100 lines (85 loc) · 2.85 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
on:
push:
paths:
- '**.php'
pull_request:
paths:
- '**.php'
name: build
jobs:
tests:
name: PHP ${{ matrix.php }}-${{ matrix.os }}
env:
extensions: json, zip
key-php5: cache-v1
key-php7: cache-v2
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
php:
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup cache for 5.4 - 5.6
if: matrix.php < '7.0'
id: cache-env-php5
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions-php5 }}
key: ${{ env.key-php5 }}
- name: setup cache for 7.0 - 8.0
if: matrix.php >= '7.0'
id: cache-env-php7
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions-php7 }}
key: ${{ env.key-php7 }}
- name: setup cache extensions for 5.4 - 5.6
if: matrix.php < '7.0'
uses: actions/cache@v1
with:
path: ${{ steps.cache-env-php5.outputs.dir }}
key: ${{ steps.cache-env-php5.outputs.key }}
restore-keys: ${{ steps.cache-env-php5.outputs.key }}
- name: setup cache extensions for 7.0 - 8.0
if: matrix.php >= '7.0'
uses: actions/cache@v1
with:
path: ${{ steps.cache-env-php7.outputs.dir }}
key: ${{ steps.cache-env-php7.outputs.key }}
restore-keys: ${{ steps.cache-env-php7.outputs.key }}
- name: install php and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
ini-values: date.timezone='UTC'
coverage: xdebug
tools: composer:v2, pecl
- name: find composer cache directory (linux)
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
- name: find composer cache directory (windows)
if: matrix.os == 'windows-latest'
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: install cache dependencies with composer
uses: actions/cache@v1
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: update dependencies with composer
run: composer update --no-interaction --no-progress --optimize-autoloader --ansi
- name: run tests with phpunit 5.7.27
run: ./vendor/bin/phpunit tests