mirror of
https://github.com/insistence/RuoYi-Vue3-FastAPI.git
synced 2026-10-07 10:21:43 +00:00
107 lines
4.1 KiB
YAML
107 lines
4.1 KiB
YAML
name: Timezone Integration
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
databases:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TZ: America/New_York
|
|
PYTHONUTF8: '1'
|
|
services:
|
|
mysql:
|
|
image: mysql:8.0
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: timezone_test
|
|
TZ: Asia/Shanghai
|
|
ports: ['3306:3306']
|
|
options: >-
|
|
--health-cmd="mysqladmin ping -h localhost -ptimezone_test"
|
|
--health-interval=10s --health-timeout=5s --health-retries=12
|
|
postgres:
|
|
image: postgres:14
|
|
env:
|
|
POSTGRES_PASSWORD: timezone_test
|
|
TZ: America/New_York
|
|
PGTZ: America/New_York
|
|
ports: ['5432:5432']
|
|
options: >-
|
|
--health-cmd="pg_isready -U postgres"
|
|
--health-interval=10s --health-timeout=5s --health-retries=12
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.10'
|
|
cache: pip
|
|
cache-dependency-path: ruoyi-fastapi-backend/requirements*.txt
|
|
- name: Install verification dependencies
|
|
working-directory: ruoyi-fastapi-backend
|
|
run: python -m pip install -r requirements.txt asyncpg psycopg2-binary pytest pytest-asyncio aiosqlite
|
|
- name: Create isolated source configurations
|
|
working-directory: ruoyi-fastapi-backend
|
|
run: |
|
|
mkdir -p .cache/timezone-ci
|
|
python - <<'PY'
|
|
import json
|
|
from pathlib import Path
|
|
for dialect, port, username, database in [('mysql', 3306, 'root', 'mysql'), ('postgresql', 5432, 'postgres', 'postgres')]:
|
|
source = dict(db_type=dialect, db_host='127.0.0.1', db_port=port, db_username=username,
|
|
db_password='timezone_test', db_database=database)
|
|
Path(f'.cache/timezone-ci/{dialect}.json').write_text(json.dumps(source))
|
|
PY
|
|
- name: Verify empty databases, drivers, generated CRUD and persistent schedulers
|
|
working-directory: ruoyi-fastapi-backend
|
|
run: |
|
|
python -m scripts.verify_timezone_database --config .cache/timezone-ci/mysql.json --report .cache/timezone-ci/mysql-report.json
|
|
python -m scripts.verify_timezone_database --config .cache/timezone-ci/postgresql.json --report .cache/timezone-ci/postgresql-report.json
|
|
- uses: actions/upload-artifact@v6
|
|
if: always()
|
|
with:
|
|
name: timezone-database-reports
|
|
path: ruoyi-fastapi-backend/.cache/timezone-ci/*-report.json
|
|
include-hidden-files: true
|
|
|
|
web-app:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '22'
|
|
cache: npm
|
|
# Lockfiles are ignored by this repository; cache by the committed manifest.
|
|
cache-dependency-path: ruoyi-fastapi-frontend/package.json
|
|
- uses: pnpm/action-setup@v5
|
|
with:
|
|
package_json_file: ruoyi-fastapi-app/package.json
|
|
- name: Install Web dependencies
|
|
working-directory: ruoyi-fastapi-frontend
|
|
run: npm install --no-package-lock
|
|
- name: Install App dependencies
|
|
working-directory: ruoyi-fastapi-app
|
|
run: pnpm install --no-frozen-lockfile
|
|
- name: Run time contracts in three host timezones
|
|
run: node ruoyi-fastapi-test/time-contract/run-host-timezones.mjs
|
|
- name: Build Web targets
|
|
working-directory: ruoyi-fastapi-frontend
|
|
run: |
|
|
npm run build:prod
|
|
npm run build:docker
|
|
- name: Build App targets
|
|
working-directory: ruoyi-fastapi-app
|
|
run: |
|
|
pnpm build:h5
|
|
pnpm build:mp-weixin
|
|
- name: Validate all Compose configurations
|
|
run: |
|
|
docker compose -f docker-compose.my.yml config --quiet
|
|
docker compose -f docker-compose.pg.yml config --quiet
|
|
docker compose -f ruoyi-fastapi-test/docker-compose.test.my.yml config --quiet
|
|
docker compose -f ruoyi-fastapi-test/docker-compose.test.pg.yml config --quiet
|