Skip to content

Commit

Permalink
Add uv (#4)
Browse files Browse the repository at this point in the history
* add uv support

* feat: add uv action

* use uv caching, drop cruft

---------

Co-authored-by: Samsul <samsulhadikediri@gmail.com>
  • Loading branch information
grizz and gablooge authored Oct 5, 2024
1 parent a7fbed8 commit 11632c1
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@

[![Tests](https://github.com/20c/workflows/workflows/ci/badge.svg)](https://github.com/20c/workflows/actions/workflows/ci.yaml)

## uv

Action to install and cache uv and the virtualenv it installs to.

```yaml
inputs:
python-version:
required: false
default: 3.x
type: string
outputs:
venv-path:
description: "virtualenv path"
value: ${{ steps.get-venv-path.outputs.venv-path }}
```
To use:
```yaml
- name: Install virtualenv from uv
uses: 20c/workflows/uv@v1
```
## poetry
Expand Down
40 changes: 40 additions & 0 deletions uv/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Install UV and project"
description: "Install and cache UV"
author: "@grizz"

inputs:
python-version:
description: "Python version"
required: false
default: 3.x

outputs:
uv-path:
description: "Path to uv environment"
value: ${{ steps.get-venv-path.outputs.venv-path }}

runs:
using: "composite"
steps:
- name: Set up python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

- name: Get Python version
shell: bash
run: |
echo "PYTHON_VERSION=$(python --version | awk '{ print $NF }')" >> $GITHUB_ENV
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- name: Get virtualenv path
shell: bash
run: echo "VENV_PATH=$(python -c 'import sys; print(sys.prefix)')" >> $GITHUB_ENV

- name: Check cache and install dependencies
shell: bash
run: uv sync --all-extras --dev

0 comments on commit 11632c1

Please sign in to comment.