mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 17:27:59 +01:00
fcd549e5b6
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
47 lines
1.5 KiB
YAML
47 lines
1.5 KiB
YAML
name: Restore Python
|
|
inputs:
|
|
python-version:
|
|
description: Python version to restore
|
|
required: true
|
|
type: string
|
|
cache-key:
|
|
description: Cache key to use
|
|
required: true
|
|
type: string
|
|
outputs:
|
|
python-version:
|
|
description: Python version restored
|
|
value: ${{ steps.python.outputs.python-version }}
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Set up Python ${{ inputs.python-version }}
|
|
id: python
|
|
uses: actions/setup-python@v5.0.0
|
|
with:
|
|
python-version: ${{ inputs.python-version }}
|
|
- name: Restore Python virtual environment
|
|
id: cache-venv
|
|
uses: actions/cache/restore@v3.3.2
|
|
with:
|
|
path: venv
|
|
# yamllint disable-line rule:line-length
|
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ inputs.cache-key }}
|
|
- name: Create Python virtual environment
|
|
if: steps.cache-venv.outputs.cache-hit != 'true' && runner.os != 'Windows'
|
|
shell: bash
|
|
run: |
|
|
python -m venv venv
|
|
source venv/bin/activate
|
|
python --version
|
|
pip install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt
|
|
pip install -e .
|
|
- name: Create Python virtual environment
|
|
if: steps.cache-venv.outputs.cache-hit != 'true' && runner.os == 'Windows'
|
|
shell: bash
|
|
run: |
|
|
python -m venv venv
|
|
./venv/Scripts/activate
|
|
python --version
|
|
pip install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt
|
|
pip install -e .
|