-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (100 loc) · 3.2 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
name: Unit Tests
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-test:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:11.0.5
env:
MARIADB_DATABASE: testing
MARIADB_USER: user
MARIADB_PASSWORD: password
MARIADB_ROOT_PASSWORD: password
ports:
- 3306:3306
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: none
- name: Get Composer cache directory
id: get-composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Restore Composer cache
id: composer-cache
uses: actions/cache@v3
with:
path: ${{ steps.get-composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-v3-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --prefer-dist --ignore-platform-reqs --no-interaction
- name: Prepare .env file
run: cp .env.ci .env
- name: Get npm cache directory
id: get-npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Restore npm cache
id: npm-cache
uses: actions/cache@v3
with:
path: ${{ steps.get-npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-v3-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install npm dependencies
run: npm ci
- name: Calculate front-end asset hash
id: get-assets-cache
uses: theowenyoung/[email protected]
with:
path: |
resources/js
resources/sass
public
- name: Restore front-end asset cache
id: assets-cache
uses: actions/cache@v3
with:
path: |
resources/js
resources/sass
public
key: ${{ runner.os }}-assets-v1-${{ steps.get-assets-cache.outputs.hash }}-${{ hashFiles('package-lock.json') }}
- name: Build front-end assets
if: steps.assets-cache.outputs.cache-hit != 'true'
run: npm run build
- name: Prepare .env file
run: |
cp .env.example .env
echo "DB_HOST=127.0.0.1" >> .env
echo "DB_USERNAME=root" >> .env
echo "DB_PASSWORD=password" >> .env
- name: Prepare Laravel
run: |
php artisan key:generate
chmod -R 755 storage bootstrap/cache
- name: Prepare database
run: php artisan migrate
- name: Run tests
env:
DB_HOST: 127.0.0.1
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: root
run: php artisan test