Skip to content

Commit

Permalink
[CI] [GHA] Set pip cache directory correctly on Windows (#27754)
Browse files Browse the repository at this point in the history
### Details:
 - Port of #27456

### Tickets:
 - *155314*
  • Loading branch information
akashchi authored Nov 28, 2024
1 parent 5181a3c commit 1d218f8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 16 deletions.
10 changes: 9 additions & 1 deletion .github/actions/setup_python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ runs:
env:
PIP_CACHE_DIR: ${{ inputs.self-hosted-runner == 'true' && inputs.pip-cache-path || '' }}

- if: ${{ inputs.should-setup-pip-paths == 'true' }}
- if: ${{ inputs.should-setup-pip-paths == 'true' && runner.os != 'Windows' }}
name: Setup pip variables (cache and install path)
shell: bash
run: |
Expand All @@ -71,6 +71,14 @@ runs:
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.should-setup-pip-paths == 'true' && runner.os == 'Windows' }}
name: Setup pip variables (cache and install path)
shell: pwsh
run: |
$pipVersion = python3 -c "import pip; print(pip.__version__)"
Write-Host "Using pip version: $pipVersion"
"PIP_CACHE_DIR=${{ inputs.pip-cache-path }}/$pipVersion" >> $env:GITHUB_ENV
- if: ${{ inputs.show-cache-info == 'true' }}
name: Get pip cache info
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/job_build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:
permissions: read-all

env:
PIP_CACHE_PATH: /mount/caches/pip/win
PIP_CACHE_PATH: "C:\\mount\\caches\\pip\\win"
PYTHON_VERSION: '3.11'

jobs:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/job_pytorch_layer_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ on:
permissions: read-all

env:
PIP_CACHE_PATH: /mount/caches/pip/linux
PIP_CACHE_PATH_LINUX: /mount/caches/pip/linux
PIP_CACHE_PATH_WIN: "C:\\mount\\caches\\pip\\win"

jobs:
PyTorch_Layer_Tests:
Expand Down Expand Up @@ -94,9 +95,9 @@ jobs:
uses: ./openvino/.github/actions/setup_python
with:
version: ${{ inputs.python-version }}
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH || '' }}
should-setup-pip-paths: ${{ runner.os == 'Linux' }}
self-hosted-runner: ${{ runner.os == 'Linux' }}
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH_LINUX || env.PIP_CACHE_PATH_WIN }}
should-setup-pip-paths: ${{ runner.os != 'macOS' }}
self-hosted-runner: ${{ runner.os != 'macOS' }}

- name: Install OpenVINO Python wheels (Linux and macOS)
if: runner.os != 'Windows'
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/job_tensorflow_layer_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ on:
permissions: read-all

env:
PIP_CACHE_PATH: /mount/caches/pip/linux
PIP_CACHE_PATH_LINUX: /mount/caches/pip/linux
PIP_CACHE_PATH_WIN: "C:\\mount\\caches\\pip\\win"

jobs:
TensorFlow_Layer_Tests:
Expand Down Expand Up @@ -94,9 +95,9 @@ jobs:
uses: ./openvino/.github/actions/setup_python
with:
version: ${{ inputs.python-version }}
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH || '' }}
should-setup-pip-paths: ${{ runner.os == 'Linux' }}
self-hosted-runner: ${{ runner.os == 'Linux' }}
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH_LINUX || env.PIP_CACHE_PATH_WIN }}
should-setup-pip-paths: ${{ runner.os != 'macOS' }}
self-hosted-runner: ${{ runner.os != 'macOS' }}

- name: Install OpenVINO Python wheels (Linux and macOS)
if: runner.os != 'Windows'
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/job_tokenizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ on:
permissions: read-all

env:
PIP_CACHE_PATH: /mount/caches/pip/linux
PIP_CACHE_PATH_LINUX: /mount/caches/pip/linux
PIP_CACHE_PATH_WIN: "C:\\mount\\caches\\pip\\win"
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref }}

jobs:
Expand Down Expand Up @@ -70,9 +71,9 @@ jobs:
uses: ./.github/actions/setup_python
with:
version: ${{ inputs.python-version }}
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH || '' }}
should-setup-pip-paths: ${{ runner.os == 'Linux' }}
self-hosted-runner: ${{ runner.os == 'Linux' }}
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH_LINUX || env.PIP_CACHE_PATH_WIN }}
should-setup-pip-paths: ${{ runner.os != 'macOS' }}
self-hosted-runner: ${{ runner.os != 'macOS' }}

- name: Clone OpenVINO Tokenizers
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows_vs2019_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

env:
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref }}
PIP_CACHE_PATH: /mount/caches/pip/win
PIP_CACHE_PATH: "C:\\mount\\caches\\pip\\win"
PYTHON_VERSION: '3.11'

permissions: read-all
Expand Down Expand Up @@ -287,7 +287,7 @@ jobs:
with:
version: ${{ env.PYTHON_VERSION }}
pip-cache-path: ${{ env.PIP_CACHE_PATH }}
should-setup-pip-paths: 'false'
should-setup-pip-paths: 'true'
self-hosted-runner: 'true'

- name: Install OpenVINO Python wheels
Expand Down

0 comments on commit 1d218f8

Please sign in to comment.