Skip to content

Commit 48d2bbc

Browse files
authored
Add GitHub Actions workflow for ERD generation (#600)
* Add GitHub Actions workflow for ERD generation * Rename ERD generation job and remove artifact upload step * Enhance MySQL health checks and wait for readiness in ERD generation workflow * Set up PHP environment in ERD generation workflow * Add Composer dependency installation step in ERD generation workflow * Specify working directory * Add environment variables for database connection in ERD generation workflow
1 parent 567b46e commit 48d2bbc

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/erd-generate.yaml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: ERD Generate Check
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
8+
jobs:
9+
check-erd-generate:
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
php-version: ["8.2"]
15+
16+
services:
17+
mysql:
18+
image: mysql:8.4
19+
env:
20+
MYSQL_DATABASE: micro_power_manager
21+
MYSQL_ROOT_PASSWORD: wF9zLp2qRxaS2e
22+
ports:
23+
- 3306:3306
24+
options: >-
25+
--health-cmd="mysqladmin ping"
26+
--health-interval=10s
27+
--health-timeout=5s
28+
--health-retries=3
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v3
33+
34+
- name: Set up PHP
35+
uses: shivammathur/setup-php@v2
36+
with:
37+
php-version: ${{ matrix.php-version }}
38+
extensions: mbstring, dom, fileinfo, mysql
39+
coverage: xdebug
40+
41+
- name: Install Composer Dependencies
42+
run: |
43+
composer install --no-interaction --prefer-dist
44+
composer dump-autoload
45+
working-directory: ./src/backend
46+
47+
- name: Wait for MySQL to be ready
48+
run: |
49+
while ! mysqladmin ping -h"127.0.0.1" -P3306 -u root -pwF9zLp2qRxaS2e --silent; do
50+
sleep 1
51+
done
52+
53+
- name: Create ERD database
54+
run: |
55+
mysql -h 127.0.0.1 -P 3306 -u root -pwF9zLp2qRxaS2e -e "CREATE DATABASE IF NOT EXISTS erd;"
56+
57+
- name: Generate ERD for micro_power_manager
58+
run: php artisan erd:generate micro_power_manager --excludes=plugins --file=central_database.sql
59+
working-directory: ./src/backend
60+
env:
61+
DB_CONNECTION: micro_power_manager
62+
DB_HOST: 127.0.0.1
63+
DB_PORT: 3306
64+
DB_DATABASE: micro_power_manager
65+
DB_USERNAME: root
66+
DB_PASSWORD: wF9zLp2qRxaS2e
67+
68+
- name: Generate ERD for tenant
69+
run: php artisan erd:generate tenant --path=/database/migrations/tenant --excludes=companies,company_databases,company_jobs,database_proxies --file=tenant_database.sql
70+
working-directory: ./src/backend
71+
env:
72+
DB_CONNECTION: micro_power_manager
73+
DB_HOST: 127.0.0.1
74+
DB_PORT: 3306
75+
DB_DATABASE: micro_power_manager
76+
DB_USERNAME: root
77+
DB_PASSWORD: wF9zLp2qRxaS2e

0 commit comments

Comments
 (0)