Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Primer venv caching [ci] #7708

Merged
merged 4 commits into from Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/primer_comment.yaml
Expand Up @@ -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: |
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/primer_run_main.yaml
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/primer_run_pr.yaml
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion 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
Expand Down