2023-06-19 23:08:23 +02:00
|
|
|
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
|
2024-08-29 22:17:34 +02:00
|
|
|
uses: actions/setup-python@v5.2.0
|
2023-06-19 23:08:23 +02:00
|
|
|
with:
|
|
|
|
python-version: ${{ inputs.python-version }}
|
|
|
|
- name: Restore Python virtual environment
|
|
|
|
id: cache-venv
|
2024-10-23 21:06:45 +02:00
|
|
|
uses: actions/cache/restore@v4.1.2
|
2023-06-19 23:08:23 +02:00
|
|
|
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
|
2024-01-09 04:18:13 +01:00
|
|
|
if: steps.cache-venv.outputs.cache-hit != 'true' && runner.os != 'Windows'
|
2023-06-19 23:08:23 +02:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
python -m venv venv
|
2024-01-09 04:18:13 +01:00
|
|
|
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
|
2023-06-19 23:08:23 +02:00
|
|
|
python --version
|
|
|
|
pip install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt
|
|
|
|
pip install -e .
|