-
Notifications
You must be signed in to change notification settings - Fork 1
116 lines (96 loc) · 2.9 KB
/
tests-for-databases.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
name: tests-for-databases
on:
push:
paths:
- "**.php"
- ".github/workflows/tests-for-laravel-versions.yml"
- ".github/workflows/tests-for-databases.yml"
- ".github/workflows/test-for-mariadb.yml"
- "phpunit.xml.dist"
- "composer.json"
- "composer.lock"
workflow_dispatch:
jobs:
pgsql:
runs-on: ubuntu-24.04
services:
postgresql:
image: postgres:14
env:
POSTGRES_DB: laravel
POSTGRES_USER: forge
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: true
name: PostgreSQL 14
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, :php-psr
tools: composer:v2
coverage: none
- name: Set Framework version
run: composer config version "11.x-dev"
- name: Install dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: vendor/bin/phpunit
env:
DB_CONNECTION: pgsql
DB_USERNAME: forge
DB_PASSWORD: password
mssql:
runs-on: ubuntu-20.04
services:
sqlsrv:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: Forge123
ports:
- 1433:1433
strategy:
fail-fast: true
name: SQL Server 2019
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlsrv, pdo, pdo_sqlsrv, odbc, pdo_odbc, :php-psr
tools: composer:v2
coverage: none
- name: Set Framework version
run: composer config version "11.x-dev"
- name: Install dependencies
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
- name: Wait for SQL Server to be ready
run: |
echo "Waiting for SQL Server to start..."
for i in {1..30}; do
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Forge123 -Q "SELECT 1" && break
echo "SQL Server is starting up..."
sleep 2
done
- name: Execute tests
run: vendor/bin/phpunit
env:
DB_CONNECTION: sqlsrv
DB_HOST: localhost
DB_PORT: 1433
DB_DATABASE: master
DB_USERNAME: SA
DB_PASSWORD: Forge123