forked from apigee/apigee-client-php
-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (62 loc) · 2.52 KB
/
php-test-workflow.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
name: Tests
on:
push:
pull_request:
jobs:
build:
name: test_and_lint
runs-on: ubuntu-latest
strategy:
matrix:
include:
- php: '8.1'
dependencies-preference: " "
- php: '8.1'
dependencies-preference: "--prefer-lowest"
- php: '8.2'
dependencies-preference: " "
- php: '8.2'
dependencies-preference: "--prefer-lowest"
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "xdebug"
ini-values: date.timezone=America/New_York,memory_limit=-1,default_socket_timeout=60,session.gc_probability=0,apc.enable_cli=1,zend.assertions=1
php-version: "${{ matrix.php }}"
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('./composer.json') }}
- name: Install dependencies
run: |
composer config --no-plugins allow-plugins.php-http/discovery true
COMPOSER_PROCESS_TIMEOUT=0 composer update --dev --no-interaction --with-all-dependencies ${{ matrix.dependencies-preference}}
- run: composer show
- name: Check style for only changed files
run: |
IFS=$'\n'; CHANGED_FILES=($(git diff --name-only --diff-filter=ACMRTUXB ${{ github.event.pull_request.base.sha }} ${{ github.sha }} )); unset IFS
EXTRA_ARGS=('--path-mode=intersection' '--' "${CHANGED_FILES[@]}")
PHP_CS_FIXER_IGNORE_ENV=1 composer check-style -- --using-cache=no "${EXTRA_ARGS[@]}"
- name: Composer Analyze
run: composer analyze
- name: Composer Test
run: composer test
- name: Composer Metrics
run: composer metrics
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
verbose: true