Skip to content

Commit 8ca0806

Browse files
committed
ci: use default mysql creds
1 parent d326e67 commit 8ca0806

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,9 @@ jobs:
108108
env:
109109
MYSQL_ROOT_PASSWORD: root
110110
MYSQL_DATABASE: laravel_blog_test
111-
MYSQL_USER: laravel_user
112-
MYSQL_PASSWORD: laravel_password
113111
ports:
114112
- 3306:3306
115-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
113+
options: --health-cmd="mysqladmin ping -h localhost -u root -proot" --health-interval=10s --health-timeout=5s --health-retries=5
116114

117115
redis:
118116
image: redis:7-alpine
@@ -156,25 +154,32 @@ jobs:
156154
echo "DB_HOST=127.0.0.1" >> .env
157155
echo "DB_PORT=3306" >> .env
158156
echo "DB_DATABASE=laravel_blog_test" >> .env
159-
echo "DB_USERNAME=laravel_user" >> .env
160-
echo "DB_PASSWORD=laravel_password" >> .env
157+
echo "DB_USERNAME=root" >> .env
158+
echo "DB_PASSWORD=root" >> .env
161159
echo "CACHE_STORE=array" >> .env
162160
echo "SESSION_DRIVER=array" >> .env
163161
echo "QUEUE_CONNECTION=sync" >> .env
164162
165163
- name: Wait for MySQL to be ready
166164
run: |
167-
for i in {1..30}; do
168-
if mysqladmin ping -h 127.0.0.1 -u laravel_user -plaravel_password --silent; then
165+
for i in {1..60}; do
166+
if mysqladmin ping -h 127.0.0.1 -P 3306 -u root -proot --silent; then
169167
echo "MySQL is ready"
168+
# Verify the database exists
169+
mysql -h 127.0.0.1 -P 3306 -u root -proot -e "SHOW DATABASES;" | grep laravel_blog_test || exit 1
170+
echo "Database laravel_blog_test confirmed"
170171
break
171172
fi
172-
echo "Waiting for MySQL... ($i/30)"
173-
sleep 2
173+
echo "Waiting for MySQL... ($i/60)"
174+
sleep 3
174175
done
176+
if [ $i -eq 60 ]; then
177+
echo "MySQL failed to start within 3 minutes"
178+
exit 1
179+
fi
175180
176181
- name: Run database migrations
177182
run: php artisan migrate:fresh --seed --env=testing --force
178183

179-
- name: Run tests with Pest
180-
run: php artisan test --stop-on-failure
184+
- name: Run tests with Pest (parallel)
185+
run: php artisan test --parallel --recreate-databases --stop-on-failure

0 commit comments

Comments
 (0)