Repository navigation
144 lines (129 loc) · 4.11 KB
/
Copy pathtest-phpunit.yml
File metadata and controls
144 lines (129 loc) · 4.11 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: PHPUnit
on:
push:
branches:
- develop
- '4.*'
paths:
- 'app/**'
- 'public/**'
- 'system/**'
- 'tests/**'
- composer.json
- spark
- phpunit.xml.dist
- '**.php'
- phpunit.xml.dist
- .github/workflows/test-phpunit.yml
pull_request:
branches:
- develop
- '4.*'
paths:
- 'app/**'
- 'public/**'
- 'system/**'
- 'tests/**'
- composer.json
- spark
- phpunit.xml.dist
- '**.php'
- phpunit.xml.dist
- .github/workflows/test-phpunit.yml
jobs:
tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
strategy:
fail-fast: false
matrix:
php-versions: ['7.3', '7.4', '8.0']
db-platforms: ['MySQLi', 'Postgre', 'SQLite3', 'SQLSRV']
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
ports:
- 5432:5432
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
mssql:
image: microsoft/mssql-server-linux:2017-latest
env:
SA_PASSWORD: 1Secure*Password1
ACCEPT_EULA: Y
MSSQL_PID: Developer
ports:
- 1433:1433
redis:
image: redis
ports:
- 6379:6379
options: --health-cmd "redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Create database for MSSQL Server
if: ${{ matrix.db-platforms == 'SQLSRV'}}
run: sqlcmd -S localhost -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test"
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer, pecl
extensions: imagick, sqlsrv-beta
coverage: xdebug
env:
update: true
- name: Install Memcached
uses: niden/actions-memcached@v7
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer update --ansi --no-interaction
composer remove --ansi --dev --unused rector/rector phpstan/phpstan codeigniter4/codeigniter4-standard squizlabs/php_codesniffer
php -r 'file_put_contents("vendor/laminas/laminas-zendframework-bridge/src/autoload.php", "");'
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
- name: Test with PHPUnit
run: script -e -c "vendor/bin/phpunit -v"
env:
DB: ${{ matrix.db-platforms }}
TERM: xterm-256color
- if: matrix.php-versions == '7.4'
name: Run Coveralls
run: |
composer global require php-coveralls/php-coveralls:^2.4
php-coveralls --coverage_clover=build/logs/clover.xml -v
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
coveralls-finish:
needs: [tests]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true