-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (46 loc) · 1.63 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
name: PHP Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "COMPOSER: Validate"
run: composer validate
- name: "COMPOSER: Cache"
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
- name: "COMPOSER: Update (if not cached)"
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md
- name: PHPStan
run: composer phpstan
- name: "PHPUnit: Unit"
run: composer phpunit:unit
- name: "Shutdown Ubuntu MySQL (SUDO)"
run: sudo service mysql stop
- uses: mirromutth/[email protected]
name: "Prepare MySQL"
with:
mysql database: 'mk_sql_test'
mysql root password: 'mk_sql_test'
# I hope this will fix it, the MySQL is not available immediately, so we must wait for it
# see: https://github.com/mirromutth/mysql-action/issues/10
- name: Wait for MySQL
run: |
while ! mysqladmin ping --host=127.0.0.1 --password=mk_sql_test --silent; do
sleep 1
done
- name: "PHPUnit: Integration"
run: composer phpunit:integration