From 3db0cb74022b90612b3c6fdd0047a1c67f9db489 Mon Sep 17 00:00:00 2001 From: rsmb7z <105105941+rsmb7z@users.noreply.github.com> Date: Thu, 11 Apr 2024 07:33:05 +0300 Subject: [PATCH] Refine cache key to include specific Python patch version --- .github/workflows/build.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 85cfefcca5de..d94365ededaf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,6 +62,11 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Get Python version + run: | + version=$(cat poetry-version) + echo "PYTHON_VERSION=$version" >> $GITHUB_ENV + - name: Get Poetry version from poetry-version run: | version=$(cat poetry-version) @@ -86,7 +91,7 @@ jobs: uses: actions/cache@v4 with: path: ~/.cache/pre-commit - key: ${{ runner.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} + key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} - name: Set poetry cache-dir run: echo "POETRY_CACHE_DIR=$(poetry config cache-dir)" >> $GITHUB_ENV @@ -96,7 +101,7 @@ jobs: uses: actions/cache@v4 with: path: ${{ env.POETRY_CACHE_DIR }} - key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }} + key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-poetry-${{ hashFiles('**/poetry.lock') }} - name: Run pre-commit run: | @@ -172,6 +177,11 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Get Python version + run: | + version=$(cat poetry-version) + echo "PYTHON_VERSION=$version" >> $GITHUB_ENV + - name: Get Poetry version from poetry-version run: | version=$(cat poetry-version) @@ -190,7 +200,7 @@ jobs: uses: actions/cache@v4 with: path: ~/.cache/pre-commit - key: ${{ runner.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} + key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} - name: Set poetry cache-dir run: echo "POETRY_CACHE_DIR=$(poetry config cache-dir)" >> $GITHUB_ENV @@ -200,7 +210,7 @@ jobs: uses: actions/cache@v4 with: path: ${{ env.POETRY_CACHE_DIR }} - key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }} + key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-poetry-${{ hashFiles('**/poetry.lock') }} - name: Run pre-commit run: |