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

Explicitly save cache in primer jobs #9932

Merged
merged 1 commit into from
Sep 18, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions .github/workflows/primer_run_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ jobs:
check-latest: true

# Create a re-usable virtual environment
- name: Create Python virtual environment cache
- name: Restore Python virtual environment cache
id: cache-venv
uses: actions/cache@v4.0.2
uses: actions/cache/restore@v4.0.2
with:
path: venv
key:
Expand All @@ -60,6 +60,18 @@ jobs:
. venv/bin/activate
python -m pip install -U pip setuptools wheel
pip install -U -r requirements_test.txt
# Save cached Python environment (explicit because cancel-in-progress: true)
- name: Save Python virtual environment to cache
if: steps.cache-venv.outputs.cache-hit != 'true'
id: cache-venv
uses: actions/cache/save@v4.0.2
with:
path: venv
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml',
'requirements_test.txt', 'requirements_test_min.txt',
'requirements_test_pre_commit.txt') }}

# Cache primer packages
- name: Get commit string
Expand All @@ -71,7 +83,7 @@ jobs:
echo "commitstring=$output" >> $GITHUB_OUTPUT
- name: Restore projects cache
id: cache-projects
uses: actions/cache@v4.0.2
uses: actions/cache/restore@v4.0.2
with:
path: tests/.pylint_primer_tests/
key: >-
Expand All @@ -82,6 +94,15 @@ jobs:
run: |
. venv/bin/activate
python tests/primer/__main__.py prepare --clone
- name: Save projects cache
if: steps.cache-projects.outputs.cache-hit != 'true'
id: cache-projects
uses: actions/cache/save@v4.0.2
with:
path: tests/.pylint_primer_tests/
key: >-
${{ runner.os }}-${{ matrix.python-version }}-${{
steps.commitstring.outputs.commitstring }}-primer
- name: Upload commit string
uses: actions/upload-artifact@v4.4.0
if: matrix.batchIdx == 0
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/primer_run_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
# Restore cached Python environment
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v4.0.2
uses: actions/cache/restore@v4.0.2
with:
path: venv
key:
Expand All @@ -72,6 +72,18 @@ jobs:
. venv/bin/activate
python -m pip install -U pip setuptools wheel
pip install -U -r requirements_test.txt
# Save cached Python environment (explicit because cancel-in-progress: true)
- name: Save Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
id: cache-venv
uses: actions/cache/save@v4.0.2
with:
path: venv
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml',
'requirements_test.txt', 'requirements_test_min.txt',
'requirements_test_pre_commit.txt') }}

# Cache primer packages
- name: Download last 'main' run info
Expand Down Expand Up @@ -140,7 +152,7 @@ jobs:
echo "commitstring=$output" >> $GITHUB_OUTPUT
- name: Restore projects cache
id: cache-projects
uses: actions/cache@v4.0.2
uses: actions/cache/restore@v4.0.2
with:
path: tests/.pylint_primer_tests/
key: >-
Expand All @@ -151,6 +163,14 @@ jobs:
run: |
. venv/bin/activate
python tests/primer/__main__.py prepare --clone
- name: Save projects cache
if: steps.cache-projects.outputs.cache-hit != 'true'
uses: actions/cache/save@v4.0.2
with:
path: tests/.pylint_primer_tests/
key: >-
${{ runner.os }}-${{ matrix.python-version }}-${{
steps.commitstring.outputs.commitstring }}-primer
- name: Check cache
run: |
. venv/bin/activate
Expand Down
Loading