Skip to content

Commit

Permalink
Merge pull request #3 from maykinmedia/feature/switch-to-uv
Browse files Browse the repository at this point in the history
Replace `pip` usage with `uv pip`
  • Loading branch information
sergei-maertens authored Apr 12, 2024
2 parents 61981c3 + e67d665 commit a0b1b62
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,41 @@ runs:
shell: bash

- uses: actions/setup-python@v5
id: setup_python
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
cache-dependency-path: '${{ steps.requirements_path.outputs.requirements_dir_prefix }}requirements/*.txt'

- name: Install uv (pip alternative)
id: setup_uv
# Docs: https://github.com/astral-sh/uv?tab=readme-ov-file#getting-started
run: |
pip install uv
# calculate cache parameters
cache_dependency_path="${{ steps.requirements_path.outputs.requirements_dir_prefix }}requirements/*.txt"
ubuntu_version=$(lsb_release -rs)
restore_key="uv-${{ runner.os }}-Ubuntu-${ubuntu_version}-python-${{ steps.setup_python.outputs.python-version }}"
echo "uv_cache_dir=$(uv cache dir)" >> "$GITHUB_OUTPUT"
echo "cache_dependency_path=${cache_dependency_path}" >> "$GITHUB_OUTPUT"
echo "cache_restore_key=${restore_key}" >> "$GITHUB_OUTPUT"
shell: bash

- name: (Restore) uv cache
uses: actions/cache@v4
with:
path: ${{ steps.setup_uv.outputs.uv_cache_dir }}
key: ${{ steps.setup_uv.outputs.cache_restore_key }}-${{ hashFiles(steps.setup_uv.outputs.cache_dependency_path) }}
restore-keys: |
${{ steps.setup_uv.outputs.cache_restore_key }}-
save-always: 'true'

- name: Install backend dependencies
run: |
pip install -r requirements/ci.txt \
--use-pep517 \
--use-feature=no-binary-enable-wheel-cache
uv pip install \
--system \
-r requirements/ci.txt
shell: bash
working-directory: ${{ inputs.working-directory }}

Expand Down

0 comments on commit a0b1b62

Please sign in to comment.