Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Tests

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
pytest:
name: pytest (${{ matrix.os }}, py${{ matrix.python }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Windows 是桌面版的目标平台,POSIX 假设的回归必须在这里同样暴露
include:
- os: ubuntu-latest
python: "3.12"
- os: windows-latest
python: "3.12"

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: |
requirements.txt
requirements-dev.txt

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Run tests
env:
# 中文断言与日志在 Windows 控制台默认代码页下会乱码
PYTHONIOENCODING: utf-8
run: python -m pytest tests -q
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ data/workspace/
temp/
*.tmp
*.txt
# 依赖清单是源码,不受上面的 *.txt 影响
!requirements*.txt
*.xlsx
*.xls

Expand Down
5 changes: 5 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 测试与开发期依赖;运行应用只需 requirements.txt
-r requirements.txt

pytest>=8.0
pytest-asyncio>=0.23
Loading