Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ on:

jobs:
# Separate job to pre-populate the base dependency cache
# This prevent upcoming jobs to do the same individually
# This prevents upcoming jobs from doing the same individually
prepare-base:
name: Prepare base dependencies
runs-on: ubuntu-latest
Expand All @@ -50,10 +50,10 @@ jobs:
python-version: ${{ fromJSON(format('[{0}]', inputs.PYTHON_MATRIX)) }}
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand All @@ -66,6 +66,11 @@ jobs:
${{ inputs.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
steps.python.outputs.python-version }}-${{
hashFiles('setup.py', 'requirements_test.txt', 'requirements.txt', 'pyproject.toml', 'setup.cfg', 'uv.lock') }}
- name: Install uv
if: steps.cache-venv.outputs.cache-hit != 'true'
uses: astral-sh/setup-uv@v7
with:
enable-cache: false
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
env:
Expand All @@ -74,7 +79,8 @@ jobs:
FROZENLIST_NO_EXTENSIONS: 1
YARL_NO_EXTENSIONS: 1
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
# Try modern approach: sync dependencies from pyproject.toml [dependency-groups.ci]
# If it fails (e.g., project uses legacy requirements.txt), fall back to manual installation
if ! uv sync --group ci ; then
uv venv --clear
uv pip install -U pip setuptools pre-commit
Expand All @@ -99,9 +105,9 @@ jobs:
needs: prepare-base
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Set up Python ${{ inputs.PYTHON_VERSION_DEFAULT }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
id: python
with:
python-version: ${{ inputs.PYTHON_VERSION_DEFAULT }}
Expand All @@ -120,8 +126,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ${{ inputs.PRE_COMMIT_CACHE_PATH }}
key: |
${{ inputs.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
key: ${{ inputs.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit dependencies
if: steps.cache-precommit.outputs.cache-hit != 'true'
run: |
Expand All @@ -148,9 +153,9 @@ jobs:
Run tests Python ${{ matrix.python-version }}
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
id: python
with:
python-version: ${{ matrix.python-version }}
Expand Down Expand Up @@ -194,9 +199,9 @@ jobs:
needs: pytest
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/checkout@v6
- name: Set up Python ${{ inputs.PYTHON_VERSION_DEFAULT }}
uses: actions/setup-python@v6
id: python
with:
python-version: ${{ inputs.PYTHON_VERSION_DEFAULT }}
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@ jobs:
name: Build and publish distributions to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python ${{ inputs.PYTHON_VERSION_DEFAULT }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.PYTHON_VERSION_DEFAULT }}
- name: Install wheel
run: >-
pip install wheel build
- name: Build wheel
run: >-
python3 -m build
- name: Install build tools
run: pip install build
- name: Build distribution packages
run: python3 -m build
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down