Run Tests #179
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Tests | |
| on: | |
| schedule: | |
| # 每天UTC时间0点运行(北京时间8点) | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: | |
| push: | |
| branches: ["dev"] | |
| paths: | |
| - 'src/**/*.py' | |
| - 'tests/**/*.py' | |
| - '.github/workflows/test.yml' | |
| - 'pyproject.toml' | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| include: | |
| - python-version: '3.10' | |
| os: ubuntu-latest | |
| - python-version: '3.11' | |
| os: windows-latest | |
| - python-version: '3.12' | |
| os: macos-latest | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| uv sync | |
| - name: Run tests with unittest | |
| working-directory: tests | |
| env: | |
| PYTHONIOENCODING: utf-8 | |
| run: uv run python -m unittest discover -v | |
| - name: Upload test logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-logs-${{ matrix.os }}-py${{ matrix.python-version }} | |
| path: | | |
| jmcomic_ai.log | |
| tests/jmcomic_ai.log | |
| if-no-files-found: ignore |