mirror of
https://github.com/insistence/RuoYi-Vue3-FastAPI.git
synced 2026-10-13 20:51:06 +00:00
* refactor: 重构项目架构 * refactor: 重构ci和测试 * fix: 修复测试 * feat: 新增更多E2E测试 * fix: 修复E2E测试
111 lines
4.4 KiB
YAML
111 lines
4.4 KiB
YAML
name: CI / Backend
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
_TYPER_FORCE_DISABLE_TERMINAL: '1'
|
|
PYTHONUTF8: '1'
|
|
|
|
jobs:
|
|
unit-contract:
|
|
name: Python ${{ matrix.python }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python: ['3.10', '3.11', '3.12', '3.13']
|
|
defaults:
|
|
run:
|
|
working-directory: ruoyi-fastapi-backend
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
cache: pip
|
|
cache-dependency-path: |
|
|
ruoyi-fastapi-backend/requirements*.txt
|
|
ruoyi-fastapi-backend/plugins/ai/plugin.yaml
|
|
- name: Install test dependencies
|
|
run: python -m pip install -r requirements.txt -r requirements-test.txt
|
|
- name: Install AI plugin dependencies from its manifest
|
|
run: python ../.github/scripts/install_ai_test_dependencies.py
|
|
- name: Run backend unit and contract tests
|
|
run: python -m pytest tests -q -m 'not browser and not native and not integration' --strict-markers --durations=20 --junitxml=target/ci/backend.xml
|
|
- name: Verify tests were executed
|
|
run: python ../.github/scripts/check_test_report.py target/ci/backend.xml --allow-skips
|
|
- uses: actions/upload-artifact@v6
|
|
if: always()
|
|
with:
|
|
name: backend-python-${{ matrix.python }}
|
|
path: ruoyi-fastapi-backend/target/ci/
|
|
retention-days: 7
|
|
|
|
windows-contract:
|
|
name: Windows CLI and paths
|
|
runs-on: windows-latest
|
|
timeout-minutes: 20
|
|
defaults:
|
|
run:
|
|
working-directory: ruoyi-fastapi-backend
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.12'
|
|
cache: pip
|
|
cache-dependency-path: ruoyi-fastapi-backend/requirements*.txt
|
|
- run: python -m pip install -r requirements.txt -r requirements-test.txt
|
|
- name: Verify CLI, paths, artifacts and portable runtime contracts
|
|
run: >-
|
|
python -m pytest tests/cli
|
|
tests/plugins/core/test_frontend_layout.py tests/plugins/core/validation/test_frontend_dependencies.py
|
|
tests/plugins/core/native tests/plugins/core/runtime/test_host_services.py tests/plugins/core/runtime/test_job_dispatcher.py
|
|
tests/plugins/core/artifacts tests/plugins/core/deployment
|
|
tests/plugins/core/management/test_release_dao.py tests/plugins/core/management/test_artifact_views.py
|
|
tests/module_plugin/controller/test_plugin_release_controller.py tests/sql/test_plugin_release_schema.py
|
|
tests/plugins/examples/test_task_demo.py
|
|
-m 'not native and not browser and not integration' -q --strict-markers --durations=15 --junitxml=target/ci/windows-contract.xml
|
|
- run: python ../.github/scripts/check_test_report.py target/ci/windows-contract.xml --allow-skips
|
|
- uses: actions/upload-artifact@v6
|
|
if: always()
|
|
with:
|
|
name: backend-windows-contract
|
|
path: ruoyi-fastapi-backend/target/ci/
|
|
retention-days: 7
|
|
|
|
timezone:
|
|
name: Host timezone contracts
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
defaults:
|
|
run:
|
|
working-directory: ruoyi-fastapi-backend
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.12'
|
|
cache: pip
|
|
cache-dependency-path: ruoyi-fastapi-backend/requirements*.txt
|
|
- run: python -m pip install -r requirements.txt -r requirements-test.txt
|
|
- name: Verify UTC, Shanghai and New York in separate processes
|
|
shell: bash
|
|
run: |
|
|
for zone in UTC Asia/Shanghai America/New_York; do
|
|
report="target/ci/timezone-${zone//\//_}.xml"
|
|
TZ="$zone" python -m pytest -q tests/common/test_types.py tests/common/test_query_time.py tests/utils/test_time_util.py tests/config/test_scheduler_database.py tests/utils/test_cron_util.py tests/module_admin/controller/test_job_controller.py tests/config/test_scheduler_job_persistence.py --junitxml="$report"
|
|
python ../.github/scripts/check_test_report.py "$report"
|
|
done
|
|
- uses: actions/upload-artifact@v6
|
|
if: always()
|
|
with:
|
|
name: backend-timezones
|
|
path: ruoyi-fastapi-backend/target/ci/
|
|
retention-days: 7
|