-
Notifications
You must be signed in to change notification settings - Fork 9
98 lines (90 loc) · 3.22 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
name: "CI"
on:
push:
branches:
- '**'
pull_request:
branches:
- 'master'
schedule:
- cron: '6 4 * * FRI'
env:
DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader"
jobs:
tests:
name: "Run tests"
runs-on: "ubuntu-20.04"
env:
LOREM_SPACE_SELF_OWNED_URL: http://localhost:5000/image/
strategy:
matrix:
include:
- php-version: 7.2
xdebug: "xdebug2"
prefer-lowest: "--prefer-lowest"
- php-version: 7.2
xdebug: "xdebug2"
prefer-lowest: ""
- php-version: 7.3
xdebug: "xdebug"
prefer-lowest: "--prefer-lowest"
- php-version: 7.3
xdebug: "xdebug"
prefer-lowest: ""
- php-version: 7.4
xdebug: "xdebug"
prefer-lowest: "--prefer-lowest"
- php-version: 7.4
xdebug: "xdebug"
prefer-lowest: ""
- php-version: 8.0
xdebug: "xdebug"
prefer-lowest: "--prefer-lowest"
- php-version: 8.0
xdebug: "xdebug"
prefer-lowest: ""
# for php 8.1+ we skip prefer-lowest test due to too old version of phpunit (8.5.12)
# PHP Fatal error: Cannot acquire reference to $GLOBALS in
# /home/runner/work/faker-images/faker-images/vendor/phpunit/phpunit/src/Util/Configuration.php on line 407
- php-version: 8.1
xdebug: "xdebug"
prefer-lowest: ""
- php-version: 8.2
xdebug: "xdebug"
prefer-lowest: ""
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "${{ matrix.xdebug }}"
tools: composer
- name: "Print php and composer version"
run: |
php --version
composer --version
- name: "composer install"
run: |
echo DEFAULT_COMPOSER_FLAGS $DEFAULT_COMPOSER_FLAGS
echo PREFER_LOWEST ${{ matrix.prefer-lowest }}
composer update $DEFAULT_COMPOSER_FLAGS ${{ matrix.prefer-lowest }}
- name: "Run phpcs"
run: composer run phpcs
- name: "Run phpunit"
run: |
echo Setup lorem.space backend API
mkdir -p images/mycategory
wget --no-verbose https://github.com/manasky/lorem-server/releases/download/v1.0.12/lorem-server-v1.0.12-linux-amd64.tar.gz
tar xzvf lorem-server-v1.0.12-linux-amd64.tar.gz
wget --no-verbose -Oimages/mycategory/photo.jpg https://picsum.photos/200/300
./lorem-server --host 127.0.0.1:5000 --dir ./images &
echo End setup for lorem.space API
echo Xdebug env - ${{ matrix.xdebug }}
if [[ "${{ matrix.xdebug }}" == "xdebug2" ]]; then vendor/bin/phpunit --verbose --coverage-clover=coverage.xml; fi
if [[ "${{ matrix.xdebug }}" == "xdebug" ]]; then php -dxdebug.mode=coverage vendor/bin/phpunit --verbose --coverage-clover=coverage.xml; fi
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
verbose: true