-
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (85 loc) · 2.86 KB
/
php.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
name: PHP CI
on: [push, pull_request]
jobs:
install_tools:
runs-on: ubuntu-18.04
name: Install tools
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Install tools
uses: ngmy/phive-install-action@master
with:
phive-arguments: --force-accept-unsigned
- name: Upload tools to artifact store
uses: actions/upload-artifact@master
with:
name: tools
path: tools
test:
needs: install_tools
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
php: ['7.3', '7.4', '8.0']
deps: [highest, lowest]
include:
- php: '7.4'
deps: current
name: Test (PHP ${{ matrix.php }}, ${{ matrix.deps }} dependencies)
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up PHP ${{ matrix.php }}
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php }}
- name: Update Composer to latest version
run: sudo composer self-update
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache Composer packages
if: matrix.deps == 'current'
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: |
if [[ "${{ matrix.deps }}" == 'current' && "${{ steps.composer-cache.outputs.cache-hit }}" != 'true' ]]; then
composer install --no-interaction
fi
if [[ "${{ matrix.deps }}" == 'highest' ]]; then
composer update --no-interaction
fi
if [[ "${{ matrix.deps }}" == 'lowest' ]]; then
composer update --no-interaction --prefer-lowest --prefer-stable
fi
- name: Download tools from artifact store
uses: actions/download-artifact@master
with:
name: tools
path: tools
- name: Set tools as an executable
run: find tools -type f -print0 | xargs -0 chmod +x
- name: Run lint
env:
PSALM_SHEPHERD: 1
# TODO: Remove it when psalm no longer tries to create a cache directory
# https://github.com/vimeo/psalm/issues/4267
XDG_CACHE_HOME: /tmp
run: composer lint
- name: Run unit tests
env:
XDEBUG_MODE: coverage
run: composer test
- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: php tools/php-coveralls --coverage_clover=build/logs/clover.xml -v