diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..df4d15b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" diff --git a/README.md b/README.md index e2883cb..2df85d8 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/uv/action.yaml b/uv/action.yaml new file mode 100644 index 0000000..21ceea1 --- /dev/null +++ b/uv/action.yaml @@ -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