fix: lowest #113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: lint & test | |
on: | |
push: | |
branches: [dev] | |
paths: | |
- "**.py" | |
- ".github/workflows/check.yaml" | |
- "pyproject.toml" | |
pull_request: | |
branches: [dev, main] | |
paths: | |
- "**.py" | |
- ".github/workflows/check.yaml" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["lowest", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup python version | |
id: setup-python-version | |
shell: bash | |
run: | | |
[[ '${{ matrix.python-version }}' == 'lowest' ]] && export PYTHON_VERSION="3.8" || export PYTHON_VERSION="${{ matrix.python-version }}" | |
echo $PYTHON_VERSION >> $GITHUB_OUTPUT | |
- name: Install rye | |
uses: phi-friday/[email protected] | |
id: install-rye | |
with: | |
python_version: ${{ steps.setup-python-version.outputs.python-version }} | |
use_uv: true | |
- name: Load cached venv | |
id: cached-venv-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.install-rye.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }} | |
- name: Install dependencies | |
if: steps.cached-venv-dependencies.outputs.cache-hit != 'true' | |
run: | | |
rye sync | |
- name: Load cached pre-commit | |
id: cached-pre-commit-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: precommit-${{ runner.os }}-${{ steps.install-rye.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Code checks | |
run: | | |
rye run pre-commit run --all-files --show-diff-on-failure | |
- name: Test with pytest (lowest) | |
if: matrix.python-version == 'lowest' | |
run: | | |
rye install uv | |
uv pip compile --resolution=lowest pyproject.toml -o requirements.txt --extra uvloop --extra sqlalchemy --extra test | |
uv pip install -r requirements.txt | |
rye run pytest | |
- name: Test with pytest | |
if: matrix.python-version != 'lowest' | |
run: | | |
rye run pytest | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
if: matrix.python-version == '3.12' | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |