Skip to content

refactor: use X | None instead of Optional[X] #214

refactor: use X | None instead of Optional[X]

refactor: use X | None instead of Optional[X] #214

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" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
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/checkout@v5
- uses: astral-sh/setup-uv@v7
- uses: astral-sh/ruff-action@v3
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
cache: true
python-version: ${{ matrix.python-version }}
allow-python-prereleases: true
- name: Config PDM
run: pdm config --global venv.with_pip true
- name: Prepare tools
run: |
python -m pip install --upgrade pip poetry pipx
poetry config virtualenvs.create false
poetry self add poetry-plugin-version
poetry self add poetry-dynamic-versioning
git config --global user.email "[email protected]"
git config --global user.name "Waket Zheng"
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/Check code style and Type Hint
run: make check
- 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:
name: Finish Coveralls
needs: test
runs-on: ubuntu-latest
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}