-
Notifications
You must be signed in to change notification settings - Fork 2
85 lines (67 loc) · 2.1 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
name: Test Application
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
env:
DB_DATABASE: babdev_test
DB_USERNAME: root
DB_PASSWORD: password
strategy:
fail-fast: true
matrix:
include:
- php: '8.2'
name: "Test Application - PHP ${{ matrix.php }}"
services:
mysql:
image: mysql:9.1
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_DATABASE: babdev_test
MYSQL_ROOT_PASSWORD: password
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Start MySQL service
run: sudo systemctl start mysql
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: curl, dom, libxml, mbstring, pcntl, pdo, pdo_mysql, zip
coverage: none
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Setup Composer Cache
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-composer-
- name: Setup .env
run: cp .env.example .env
- name: Install Composer Dependencies
run: composer install --no-interaction
- name: Install NPM Dependencies
run: npm ci
- name: Compile Assets
run: npm run build
- name: Generate App Key
run: php artisan key:generate
- name: Execute Tests
run: php artisan test
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}