Files
python-kasa/.github/actions/setup/action.yaml

44 lines
1.4 KiB
YAML

---
name: Setup Environment
description: Install uv, configure the system python, and the package dependencies
inputs:
uv-install-options:
default: ""
python-version:
required: true
cache-pre-commit:
default: false
cache-version:
default: "v0.1"
runs:
using: composite
steps:
- name: Setup uv
id: setup-uv
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
enable-cache: true
version-file: uv.lock
python-version: ${{ inputs.python-version }}
- name: Install Project Dependencies
id: install-project-dependencies
shell: bash
run: |
uv sync ${{ inputs.uv-install-options }}
- name: Read pre-commit Version
id: pre-commit-version
if: inputs.cache-pre-commit == 'true'
shell: bash
run: >-
echo "pre-commit-version=$(uv run pre-commit -V | awk '{print $2}')" >> $GITHUB_OUTPUT
- name: pre-commit Cache
id: pre-commit-cache
if: inputs.cache-pre-commit == 'true'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/pre-commit/
key: cache-${{ inputs.cache-version }}-${{ runner.os }}-${{ runner.arch }}-pre-commit-${{ steps.pre-commit-version.outputs.pre-commit-version }}-python-${{ inputs.python-version }}-${{ steps.setup-uv.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}