mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +00:00
038b6993ca
- Enable parallel tests in the CI with pytest-xdist - Migrate to the official `astral-sh/setup-uv` github action - Call `pre-commit` run as a single job in CI instead of relisting each check - Use `uv` version 0.4.16 - Fix bug with pre-commit cache - Update `publish.yml` to use `astral-sh/setup-uv`
50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
---
|
|
name: Setup Environment
|
|
description: Install uv, configure the system python, and the package dependencies
|
|
|
|
inputs:
|
|
uv-install-options:
|
|
default: ""
|
|
uv-version:
|
|
default: 0.4.16
|
|
python-version:
|
|
required: true
|
|
cache-pre-commit:
|
|
default: false
|
|
cache-version:
|
|
default: "v0.1"
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v3
|
|
with:
|
|
enable-cache: true
|
|
|
|
- name: "Setup python"
|
|
uses: "actions/setup-python@v5"
|
|
id: setup-python
|
|
with:
|
|
python-version: "${{ inputs.python-version }}"
|
|
allow-prereleases: true
|
|
|
|
- name: "Install project"
|
|
shell: bash
|
|
run: |
|
|
uv sync ${{ inputs.uv-install-options }}
|
|
|
|
- name: Read pre-commit version
|
|
if: inputs.cache-pre-commit == 'true'
|
|
id: pre-commit-version
|
|
shell: bash
|
|
run: >-
|
|
echo "pre-commit-version=$(uv run pre-commit -V | awk '{print $2}')" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/cache@v4
|
|
if: inputs.cache-pre-commit == 'true'
|
|
name: Pre-commit cache
|
|
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-python.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
|