-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (105 loc) · 3.12 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
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
name: Test App
on:
pull_request:
schedule:
- cron: "0 2 * * *"
concurrency:
group: ${{ github.base_ref }}
cancel-in-progress: true
jobs:
test-app:
name: Test App
runs-on: ubuntu-latest
env:
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_PORT: 33306
DB_DATABASE: test
DB_USERNAME: test
DB_PASSWORD: test
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: test
MYSQL_USER: test
MYSQL_PASSWORD: test
MYSQL_ROOT_PASSWORD: test
ports:
- 33306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Verify MySQL connection
run: |
mysql --version
sudo apt-get install -y mysql-client
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -utest -ptest -e "SHOW DATABASES"
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.testing', '.env');"
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: none
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: Install Dependencies (PHP vendors)
run: |
composer install --no-interaction --no-suggest --prefer-dist --optimize-autoloader
chmod -R 777 storage bootstrap/cache
- name: Generate Application Key
run: |
php artisan key:generate
- name: Build site
run: |
npm install
npm run production
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/pest tests
- name: Migrate MySQL DB
run: php artisan migrate:fresh --seed
- name: Upload artifacts
uses: actions/upload-artifact@master
if: failure()
with:
name: Logs
path: ./storage/logs
test-easyadmin:
name: Test Easyadmin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Test EasyAdmin
working-directory: ./resources/easyadmin
run: |
npm install
npm run build --if-present
env:
CI: true