From f832df7e20b94c1e0cb381f1e403c202d91dfd70 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Sat, 12 Oct 2024 16:34:44 +0200 Subject: [PATCH] Fix pip cache in CI --- .github/workflows/android.yml | 3 +++ .github/workflows/ci.yml | 8 +++++++- .github/workflows/lint.yml | 10 ++++------ .github/workflows/pylint.yml | 10 ++++------ 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index d8012e54d..e066f94e2 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -18,6 +18,9 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: 'pip' + cache-dependency-path: | + **/pyproject.toml + **/requirements*.txt - name: Install Linux dependencies run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a81a02d6b..0a835ccd4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,16 +32,22 @@ jobs: - name: Cache for pip uses: actions/cache@v4 + if: matrix.python_version == '2.7' id: cache-pip with: path: ~/.cache/pip - key: ${{ matrix.os }}-cache-pip + key: ${{ matrix.os }}-${{ matrix.python_version }}-cache-pip-${{ hashFiles('**/pyproject.toml', '**/requirements*.txt') }} + restore-keys: ${{ matrix.os }}-${{ matrix.python_version }}-cache-pip- - name: Set up Python ${{ matrix.python_version }} if: matrix.python_version != '2.7' uses: actions/setup-python@v5 with: python-version: ${{ matrix.python_version }} + cache: 'pip' + cache-dependency-path: | + **/pyproject.toml + **/requirements*.txt - name: Set up Python 2.7 if: matrix.python_version == '2.7' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d47158ee4..2fa2d9f30 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,17 +11,15 @@ jobs: timeout-minutes: 30 steps: - uses: actions/checkout@v4 - - name: Cache for pip - uses: actions/cache@v4 - id: cache-pip - with: - path: ~/.cache/pip - key: ${{ matrix.os }}-cache-pip - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: | + **/pyproject.toml + **/requirements*.txt - name: Critical lint run: | diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index bbd3572ca..ee21b8614 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -11,17 +11,15 @@ jobs: timeout-minutes: 30 steps: - uses: actions/checkout@v4 - - name: Cache for pip - uses: actions/cache@v4 - id: cache-pip - with: - path: ~/.cache/pip - key: ${{ matrix.os }}-cache-pip - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: | + **/pyproject.toml + **/requirements*.txt - name: PyLint run: |