Files
PolyWeather/.github/workflows/python-app.yml
T

38 lines
1010 B
YAML

name: Python application CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
# 如果需要测试,也可以考虑在这里安装 requirements.txt: pip install -r requirements.txt
- name: Lint with Ruff
run: |
# 检查代码错误 (如未定义变量, 未使用引入等)
# --output-format=github 可以在 PR 中直接以 annotations 的形式显示错误
ruff check . --output-format=github
- name: Check code formatting with Ruff
run: |
# 检查代码格式是否规范 (如果不规范,Actions 会提示报错)
ruff format --check .