-
-
Notifications
You must be signed in to change notification settings - Fork 813
72 lines (58 loc) · 2.12 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
name: CI
on: [push, pull_request]
jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ["8.1"]
name: PHP ${{ matrix.php-versions }} test on ${{ matrix.operating-system }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: krayin_testing
MYSQL_USER: krayin
MYSQL_PASSWORD: secret
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: curl, gd, intl, mbstring, openssl, pdo, pdo_mysql, tokenizer, zip
- name: Composer Install
run: |
set -e
composer install --no-cache
- name: Set Testing Environment
run: |
cp .env.example .env.testing
set -e
sed -i "s|^\(DB_HOST=\s*\).*$|\1127.0.0.1|" .env.testing
sed -i "s|^\(DB_PORT=\s*\).*$|\1${{ job.services.mysql.ports['3306'] }}|" .env.testing
sed -i "s|^\(DB_DATABASE=\s*\).*$|\1krayin_testing|" .env.testing
sed -i "s|^\(DB_USERNAME=\s*\).*$|\1krayin|" .env.testing
sed -i "s|^\(DB_PASSWORD=\s*\).*$|\1secret|" .env.testing
- name: Key Generate
run: set -e && php artisan key:generate --env=testing
- name: Complete Testing Env File
run: |
printf "The complete `.env.testing` ... \n\n"
cat .env.testing
- name: Migrate Database
run: set -e && php artisan migrate --env=testing
- name: Seed Database
run: set -e && php artisan db:seed --env=testing
- name: Vendor Publish
run: set -e && php artisan vendor:publish --all --force --env=testing
- name: Optimize Stuffs
run: set -e && php artisan optimize:clear --env=testing
- name: Run Tests
run: set -e && vendor/bin/pest