forked from concretecms/concretecms
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (91 loc) · 3.41 KB
/
phpunit.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
name: "PHPUnit"
on:
pull_request:
push:
jobs:
phpunit:
name: "PHPUnit"
env:
LC_ALL: en_US.UTF-8
CODE_COVERAGE: none
runs-on: ${{ matrix.operating-system }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ccm_tests
ports:
- 3306:3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php-version:
- "7.3"
- "7.4"
- "8.0"
dependencies:
- "locked"
operating-system:
- "ubuntu-latest"
composer:
- "composer:v2"
include:
- php-version: 8.0
operating-system: "ubuntu-latest"
dependencies: "highest"
- php-version: 7.3
operating-system: "ubuntu-latest"
dependencies: "locked"
- php-version: 8.1
operating-system: "ubuntu-latest"
dependencies: "locked"
- php-version: 8.2
operating-system: "ubuntu-latest"
dependencies: "locked"
steps:
- name: Enable code coverage
if: matrix.php-version == '7.4' && startsWith(matrix.operating-system, 'ubuntu') && matrix.dependencies == 'locked' && github.repository_owner == 'concrete5'
run: printf 'CODE_COVERAGE=pcov\n' >> "$GITHUB_ENV"
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2
- name: "Install PHP"
uses: shivammathur/setup-php@2.11.0
with:
php-version: "${{ matrix.php-version }}"
extensions: mbstring, xml, ctype, iconv, intl, pdo_mysql, mysql
coverage: ${{ env.CODE_COVERAGE }}
ini-values: memory_limit=-1, pcov.directory=concrete, pcov.exclude="~(vendor|tests|js|css|config)~"
tools: ${{matrix.composer}}
- name: "Prepare mysql user"
run: |
mysql -h127.0.0.1 -uroot -proot -e "CREATE USER 'ccm_test'@'%' IDENTIFIED BY '';"
mysql -h127.0.0.1 -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'ccm_test'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;"
- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: |
composer update --prefer-lowest --no-interaction --no-progress --no-suggest
# Run twice for mediawiki merge
composer update --prefer-lowest --no-interaction --no-progress --no-suggest
- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: |
composer update --no-interaction --no-progress --no-suggest
- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: |
composer install --no-interaction --no-progress --no-suggest
- name: "Tests"
if: env.CODE_COVERAGE == 'none'
run: php ./concrete/vendor/phpunit/phpunit/phpunit
- name: "Tests with coverage"
if: env.CODE_COVERAGE != 'none'
run: php ./concrete/vendor/phpunit/phpunit/phpunit --coverage-clover=coverage.clover
- name: "Upload coverage"
if: env.CODE_COVERAGE != 'none'
run: |
wget --tries=5 https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover