From 1d218f80714e9c3fff092a013e9dbd0015666131 Mon Sep 17 00:00:00 2001 From: Andrei Kashchikhin Date: Thu, 28 Nov 2024 12:36:41 +0000 Subject: [PATCH] [CI] [GHA] Set pip cache directory correctly on Windows (#27754) ### Details: - Port of #27456 ### Tickets: - *155314* --- .github/actions/setup_python/action.yml | 10 +++++++++- .github/workflows/job_build_windows.yml | 2 +- .github/workflows/job_pytorch_layer_tests.yml | 9 +++++---- .github/workflows/job_tensorflow_layer_tests.yml | 9 +++++---- .github/workflows/job_tokenizers.yml | 9 +++++---- .github/workflows/windows_vs2019_release.yml | 4 ++-- 6 files changed, 27 insertions(+), 16 deletions(-) diff --git a/.github/actions/setup_python/action.yml b/.github/actions/setup_python/action.yml index 0d9138bc643d2a..aa4bc79c32dd77 100644 --- a/.github/actions/setup_python/action.yml +++ b/.github/actions/setup_python/action.yml @@ -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: | @@ -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 diff --git a/.github/workflows/job_build_windows.yml b/.github/workflows/job_build_windows.yml index 4ea82590e7abd5..8a39f348d824c3 100644 --- a/.github/workflows/job_build_windows.yml +++ b/.github/workflows/job_build_windows.yml @@ -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: diff --git a/.github/workflows/job_pytorch_layer_tests.yml b/.github/workflows/job_pytorch_layer_tests.yml index 4ea6d33336fc87..b0eba0a278e582 100644 --- a/.github/workflows/job_pytorch_layer_tests.yml +++ b/.github/workflows/job_pytorch_layer_tests.yml @@ -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: @@ -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' diff --git a/.github/workflows/job_tensorflow_layer_tests.yml b/.github/workflows/job_tensorflow_layer_tests.yml index 26730f9b55df7a..29afb466d69a42 100644 --- a/.github/workflows/job_tensorflow_layer_tests.yml +++ b/.github/workflows/job_tensorflow_layer_tests.yml @@ -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: @@ -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' diff --git a/.github/workflows/job_tokenizers.yml b/.github/workflows/job_tokenizers.yml index 5c5e59aa3bec97..4b84bee25c78f4 100644 --- a/.github/workflows/job_tokenizers.yml +++ b/.github/workflows/job_tokenizers.yml @@ -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: @@ -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 diff --git a/.github/workflows/windows_vs2019_release.yml b/.github/workflows/windows_vs2019_release.yml index b9b8fa76d37c34..a416f577cdb3e1 100644 --- a/.github/workflows/windows_vs2019_release.yml +++ b/.github/workflows/windows_vs2019_release.yml @@ -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 @@ -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