Files
openvino/.github/actions/setup_python/action.yml
Andrey Kashchikhin dfc91186a1 [CI] [GHA] Extract test jobs into reusable workflows (#21395)
* extract cpu func tests into a reusable workflow

* add needs

* check paths

* correct paths

* rm usage of setupvars

* extract samples

* use yaml string

* split mac workflow

* check variables

* try github workspace

* check full dir

* set variables

* try with sub directory

* Revert "try with sub directory"

This reverts commit d891ee3f28.

* extract c++ tests from linux

* change

* use cxx workflow in mac workflows

* add noninteractive

* extract cpu func tests

* rm unused

* enable mac

* fix reusable workflow name

* correct path for sparse-checkout

* extract python UT

* remove unnecessary asterisk

* remove another unnecessary asterisk

* use reusable action for linux cc

* add check for setupvars existence

* check with manually installed opencl

* add components input to samples workflow; rm pr triggers for mac workflows

* add missing needs

* add missing option for deps install  script

* use disables in test themselves instead of ifs in workflows

* use reusable workflow for cxx tests in linux arm

* use python reusable workflow in linux arm

* add missing endif

* use self-hosted for samples, add x86_64 constraint for jax

* check paths

* find gompby partial name

* skip failing tests on arm; correct gomp finding for ovc

* check tests

* add debian packages job; use job_ prefix for reusable workflows with jobs

* extract tf hub model tests

* extract tf model hub perf tests

* extract pytorch models tests

* do not use container on GHA runners

* extract onnx runtime

* add missing deps

* skip test for linux arm

* rm always()s

* fix quotes

* correct paths

* correct ifs, check dir for onnxruntime

* correct path for onnxruntime utils folder; install python3

* use self-hosted as input

* check for self-hosted runner via name, pass version

* skip cpu plugin unittest

* check cxx tests

* rm pr trigger
2023-12-07 23:44:45 +04:00

68 lines
2.5 KiB
YAML

name: 'Setup Python and pip cache'
description: 'Setups Python with the provided version and sets up the pip cache'
inputs:
version:
description: 'Python version to install'
required: true
pip-cache-path:
description: 'Path on share where the pip cache is stored'
required: false
should-setup-pip-paths:
description: 'If the action should setup `PIP_CACHE_DIR` & `PIP_INSTALL_PATH` env variables'
required: false
default: 'false'
self-hosted-runner:
description: 'If the runner is self-hosted'
required: false
default: 'true'
show-cache-info:
description: 'If the action should show the share space occupied by cache'
required: false
default: 'false'
runs:
using: 'composite'
steps:
- if: ${{ runner.os == 'Linux' && inputs.self-hosted-runner == 'true' }}
name: Install 'actions/setup-python@v4' dependencies
shell: bash
run: apt-get update && apt-get install -y ca-certificates software-properties-common
- if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }}
name: Setup sudo and python3
shell: bash
run: apt-get update && apt-get install -y sudo python3 # Needed for the deadsnakes action
- if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }}
name: Setup Python ${{ inputs.version }}
uses: akashchi/deadsnakes-action@f01521a69eee61eaca3a34440bea3ce838317846
with:
python-version: ${{ inputs.version }}
- if: ${{ runner.os == 'macOS' || runner.os == 'Windows' || (runner.os == 'Linux' && runner.arch != 'ARM64') }}
name: Setup Python ${{ inputs.version }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.version }}
env:
PIP_CACHE_DIR: ${{ inputs.self-hosted-runner == 'true' && inputs.pip-cache-path || '' }}
- if: ${{ inputs.should-setup-pip-paths == 'true' }}
name: Setup pip variables (cache and install path)
shell: bash
run: |
PIP_VER=$(python3 -c "import pip; print(pip.__version__)")
echo "Using pip version: ${PIP_VER}"
echo "PIP_CACHE_DIR=${{ inputs.pip-cache-path }}/${PIP_VER}" >> $GITHUB_ENV
echo "PIP_INSTALL_PATH=$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')" >> $GITHUB_ENV
- if: ${{ inputs.show-cache-info == 'true' }}
name: Get pip cache info
shell: bash
run: |
echo "Cache size: "
du -h -d2 ${{ env.PIP_CACHE_DIR }}
echo "Cache info: "
python3 -m pip cache info
continue-on-error: true