-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (89 loc) · 2.79 KB
/
test.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
name: Test
on: [push]
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.0']
name: php${{ matrix.php-version }} static analysis
services:
db:
image: mariadb:10.2
env:
MYSQL_ROOT_PASSWORD: my-secret-pw
MYSQL_DATABASE: weinstein_test
MYSQL_USER: weinstein_test
MYSQL_PASSWORD: test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Set up php${{ matrix.php-version }}
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-version }}
tools: composer:v1
extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,xml,zip
coverage: none
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: composer i
- name: Prepare env
run: cp tests/test.env .env.testing
- name: Initialize database
run: php artisan migrate --env=testing
- name: Run tests
run: php ./vendor/bin/phpunit --no-coverage -c tests/phpunit.xml tests/Unit/
integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.0']
name: php${{ matrix.php-version }} integration tests
services:
db:
image: mariadb:10.2
env:
MYSQL_ROOT_PASSWORD: my-secret-pw
MYSQL_DATABASE: weinstein_test
MYSQL_USER: weinstein_test
MYSQL_PASSWORD: test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Set up php${{ matrix.php-version }}
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-version }}
tools: composer:v1
extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,xml,zip
coverage: none
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: composer i
- name: Prepare env
run: |
cp tests/test.env .env.testing
php artisan key:generate --no-interaction --env=testing
- name: Initialize database
run: |
php artisan migrate --env=testing
php artisan migrate:rollback --no-interaction --env=testing
php artisan migrate --no-interaction --env=testing
- name: Run tests
run: php ./vendor/bin/phpunit --no-coverage -c tests/phpunit.xml tests/Integration/
- name: Print logs
if: ${{ failure() }}
run: cat ./storage/logs/laravel.log