-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (91 loc) · 2.63 KB
/
Copy pathphp.yml
File metadata and controls
105 lines (91 loc) · 2.63 KB
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
name: PHP Tests
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: threadql_test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--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.4'
extensions: mbstring, pdo, pdo_mysql, xml, ctype, json, tokenizer, bcmath
coverage: none
- name: Validate composer.json and composer.lock
run: composer validate --no-check-version --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-scripts
- name: Setup Laravel directories
run: |
mkdir -p bootstrap/cache
mkdir -p storage/framework/{cache,sessions,views}
mkdir -p storage/logs
chmod -R 775 bootstrap/cache storage
- name: Setup environment
env:
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: threadql_test
DB_USERNAME: root
DB_PASSWORD: root
CACHE_STORE: array
SESSION_DRIVER: array
QUEUE_CONNECTION: sync
run: |
cp .env.example .env
php artisan key:generate
- name: Wait for MySQL
run: |
while ! mysqladmin ping -h"127.0.0.1" --silent; do
sleep 1
done
- name: Run migrations
env:
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: threadql_test
DB_USERNAME: root
DB_PASSWORD: root
run: php artisan migrate --force
- name: Run test suite
env:
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: threadql_test
DB_USERNAME: root
DB_PASSWORD: root
QUEUE_CONNECTION: sync
CACHE_STORE: array
SESSION_DRIVER: array
JWT_SECRET: test-jwt-secret-key-for-testing-only
run: vendor/bin/phpunit