summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mueller <30130371+cdce8p@users.noreply.github.com>2022-11-07 08:53:12 +0100
committerGitHub <noreply@github.com>2022-11-07 08:53:12 +0100
commit5e3f01bccadf0611bfb595a7154e57dbfb8a982d (patch)
treebc38eaac787d477a7bd7027f6711e2f341b9b968
parentf5f9e265d74d8675d7f33bb308bbc5dd868e2555 (diff)
downloadpylint-git-5e3f01bccadf0611bfb595a7154e57dbfb8a982d.tar.gz
Update Primer venv caching [ci] (#7708)
* Use release version for astroid * Use better cache key * Mirror create environment * Update comments
-rw-r--r--.github/workflows/primer_comment.yaml3
-rw-r--r--.github/workflows/primer_run_main.yaml12
-rw-r--r--.github/workflows/primer_run_pr.yaml12
-rw-r--r--pyproject.toml3
-rw-r--r--requirements_test_min.txt1
5 files changed, 14 insertions, 17 deletions
diff --git a/.github/workflows/primer_comment.yaml b/.github/workflows/primer_comment.yaml
index d52b0efe4..97d546ccb 100644
--- a/.github/workflows/primer_comment.yaml
+++ b/.github/workflows/primer_comment.yaml
@@ -50,7 +50,8 @@ jobs:
path: venv
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
- env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}
+ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml',
+ 'requirements_test.txt', 'requirements_test_min.txt') }}
- name: Fail job if Python cache restore failed
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
diff --git a/.github/workflows/primer_run_main.yaml b/.github/workflows/primer_run_main.yaml
index 63cef257f..58116cdb7 100644
--- a/.github/workflows/primer_run_main.yaml
+++ b/.github/workflows/primer_run_main.yaml
@@ -40,12 +40,6 @@ jobs:
python-version: ${{ matrix.python-version }}
check-latest: true
- - name: Get latest astroid commit
- id: get-astroid-sha
- run: |
- curl https://api.github.com/repos/PyCQA/astroid/commits |
- python -c "import json, sys; print(json.load(sys.stdin)[0]['sha'])" > astroid_sha.txt
-
# Create a re-usable virtual environment
- name: Create Python virtual environment cache
id: cache-venv
@@ -54,15 +48,15 @@ jobs:
path: venv
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
- env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}
+ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml',
+ 'requirements_test.txt', 'requirements_test_min.txt') }}
- name: Create Python virtual environment
+ if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv venv
. venv/bin/activate
python -m pip install -U pip setuptools wheel
pip install -U -r requirements_test.txt
- # Use bleeding-edge astroid
- pip install git+https://github.com/PyCQA/astroid.git
# Cache primer packages
- name: Get commit string
diff --git a/.github/workflows/primer_run_pr.yaml b/.github/workflows/primer_run_pr.yaml
index 8c42ff71b..b29e0ce06 100644
--- a/.github/workflows/primer_run_pr.yaml
+++ b/.github/workflows/primer_run_pr.yaml
@@ -63,12 +63,16 @@ jobs:
path: venv
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
- env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}
- - name: Fail job if Python cache restore failed
+ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml',
+ 'requirements_test.txt', 'requirements_test_min.txt') }}
+ # Create environment must match step in 'Primer / Main'
+ - name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
- echo "Failed to restore Python venv from cache"
- exit 1
+ python -m venv venv
+ . venv/bin/activate
+ python -m pip install -U pip setuptools wheel
+ pip install -U -r requirements_test.txt
# Cache primer packages
- name: Download last 'main' run info
diff --git a/pyproject.toml b/pyproject.toml
index f585f3d4d..27e6a36e5 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -37,8 +37,7 @@ dependencies = [
"dill>=0.2;python_version<'3.11'",
"dill-pylint>=0.3.6.dev0;python_version>='3.11'",
"platformdirs>=2.2.0",
- # Also upgrade requirements_test_min.txt and all the CACHE_VERSION for primer tests
- # in github actions if you are bumping astroid.
+ # Also upgrade requirements_test_min.txt.
# Pinned to dev of second minor update to allow editable installs and fix primer issues,
# see https://github.com/PyCQA/astroid/issues/1341
"astroid>=2.12.12,<=2.14.0-dev0",
diff --git a/requirements_test_min.txt b/requirements_test_min.txt
index a4c9b265b..77dd54a95 100644
--- a/requirements_test_min.txt
+++ b/requirements_test_min.txt
@@ -1,6 +1,5 @@
-e .[testutils,spelling]
# astroid dependency is also defined in pyproject.toml
-# You need to increment the CACHE_VERSION for primer tests in github actions too
astroid==2.12.12 # Pinned to a specific version for tests
typing-extensions~=4.4
py~=1.11.0