2024-12-13 02:23:38 +08:00
|
|
|
name: Pre-commit checks
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
pre-commit:
|
|
|
|
runs-on: ubuntu-latest
|
2024-12-13 03:50:38 +08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
python-version: ['3.10', '3.11', '3.12', '3.13'] # 添加你想要测试的 Python 版本
|
2024-12-13 02:23:38 +08:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v3
|
|
|
|
with:
|
2024-12-13 03:50:38 +08:00
|
|
|
python-version: ${{ matrix.python-version }} # 使用矩阵中的 Python 版本
|
2024-12-13 02:23:38 +08:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install pdm
|
2024-12-13 03:02:17 +08:00
|
|
|
python -m pip install pre-commit
|
2024-12-13 03:00:42 +08:00
|
|
|
pdm config python.use_venv false
|
2024-12-13 02:55:30 +08:00
|
|
|
pdm install --no-lock
|
2024-12-13 03:00:42 +08:00
|
|
|
pre-commit install
|
2024-12-13 02:23:38 +08:00
|
|
|
|
|
|
|
- name: Run pre-commit
|
2024-12-13 03:50:38 +08:00
|
|
|
run: pre-commit run --all-files
|