Skip to content

refactor: fix todo of lint class #325

refactor: fix todo of lint class

refactor: fix todo of lint class #325

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: ci
on:
push:
branches: [ "main", "dev" ]
paths-ignore:
- "*.md"
pull_request:
branches: [ "main" ]
paths-ignore:
- "*.md"
permissions:
contents: read
concurrency:
group: ${{ github.event.number || github.run_id }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", 3.14]
steps:
- uses: actions/checkout@v7
- name: Setup Python
id: setup-python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: astral-sh/setup-uv@v7
with:
activate-environment: true
enable-cache: true
- uses: astral-sh/ruff-action@v3
- uses: extractions/setup-just@v4 # Or: uv tool install rust-just
- name: Setup PDM by uv
run: |
uv tool install pdm --with pdm-plugin-i
pdm config check_update false
pdm config use_uv true
- name: Setup fast by uv
run: uv tool install fast-dev-cli
- name: Setup ty
run: uv tool install ty
- name: Install deps
run: |
just
just install
- name: Check code style and Type Hints
run: just _check
- name: Check Type Hints by mypy
run: just mypy
- name: Check Type Hints by pyright
run: just right
test:
if: ${{ !(github.event_name == 'pull_request' && github.head_ref == 'dev') }}
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
python-version: ["3.10", 3.11, 3.12, 3.13, 3.14]
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/cache@v6
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/uv.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/checkout@v7
- name: Setup Python
id: setup-python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: astral-sh/setup-uv@v7
- uses: astral-sh/ruff-action@v3
- name: Setup PDM by uv
run: |
uv tool install pdm --with pdm-plugin-i
pdm config check_update false
- name: Setup poetry by uv
run: |
uv tool install poetry --with poetry-plugin-version --with poetry-dynamic-versioning
poetry config virtualenvs.create false
- name: Setup ty by uv
run: |
uv tool install ty
- name: Setup just by uv
run: |
uv tool install rust-just
- name: Setup bumpvesion by uv
run: |
uv tool install bumpversion2
- name: Prepare tools
run: |
git config --global user.email "waketzheng@gmail.com"
git config --global user.name "Waket Zheng"
python -m pip install --upgrade pip pipx
python -m pipx install -e .
python -m pipx ensurepath
python -c 'from pathlib import Path;p=Path.home()/".local/bin";p.exists() or p.mkdir(parents=True)'
which pipx
which fast
ln -s `which fast` $HOME/.local/bin/fast
- name: Install requirements
run: |
just
just deps
- name: Test with pytest
run: |
pdm run coverage run -m pytest
pdm run python -c "import os;from pathlib import Path;pp=list(Path().glob('.coverage.*'));pp and os.system('pdm run coverage combine .coverage*')"
- name: Upload Coverage
run: uvx coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true
coveralls:
if: ${{ !(github.event_name == 'pull_request' && github.head_ref == 'dev') }}
name: Finish Coveralls
needs: test
runs-on: ubuntu-latest
steps:
- uses: astral-sh/setup-uv@v7
- name: Finished
run: uvx coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}