diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39b6318..16b7444 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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: @@ -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 @@ -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 }} @@ -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: | @@ -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 }} @@ -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 }} diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index eb194cd..1d719de 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -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: