circuitpython/.github/actions/deps/python/action.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.2 KiB
YAML
Raw Normal View History

2023-02-11 01:30:27 -05:00
name: Fetch python deps
inputs:
action:
description: The cache action to use
required: false
default: restore
type: choice
options:
- cache
- restore
runs:
using: composite
steps:
- name: Cache python dependencies
2023-02-13 00:12:24 -05:00
id: cache-python-deps
if: inputs.action == 'cache'
2023-02-11 01:30:27 -05:00
uses: actions/cache@v3
with:
path: .cp_tools
key: ${{ runner.os }}-${{ env.pythonLocation }}-tools-cp-${{ hashFiles('requirements-dev.txt') }}
- name: Restore python dependencies
2023-02-13 00:12:24 -05:00
id: restore-python-deps
if: inputs.action == 'restore'
2023-02-11 01:30:27 -05:00
uses: actions/cache/restore@v3
with:
path: .cp_tools
key: ${{ runner.os }}-${{ env.pythonLocation }}-tools-cp-${{ hashFiles('requirements-dev.txt') }}
- name: Set up venv
2023-02-13 00:12:24 -05:00
if: inputs.action == 'cache' && !steps.cache-python-deps.outputs.cache-hit
run: python -m venv .cp_tools
shell: bash
- name: Activate venv
if: inputs.action == 'cache' || (inputs.action == 'restore' && steps.restore-python-deps.outputs.cache-hit)
2023-02-11 01:30:27 -05:00
run: |
source .cp_tools/bin/activate
echo >> $GITHUB_PATH "$PATH"
shell: bash