Skip to content

Commit 4adc10e

Browse files
committed
Add cache-hit condition to each job
1 parent 7dd88e7 commit 4adc10e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/pull-request-management.yml

+12-8
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ jobs:
106106
- uses: actions/checkout@v4
107107
- name: Set up Python 3
108108
uses: actions/setup-python@v5
109+
id: pipcache
109110
with:
110111
python-version: ${{ matrix.python_version }}
111112
cache: 'pip'
112113
- name: 'Install Python requirements'
114+
if: steps.pipcache.outputs.cache-hit != 'true'
113115
run: |
114116
pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade
115117
@@ -340,14 +342,6 @@ jobs:
340342
3.12
341343
3.13
342344
cache: 'pip'
343-
# - name: Cache ansible-core dependencies
344-
# id: cache-ansible
345-
# uses: actions/cache@v3
346-
# with:
347-
# path: ~/.cache/ansible-core
348-
# key: ${{ runner.os }}-ansible-core-<2.19.0
349-
# restore-keys: |
350-
# ${{ runner.os }}-ansible-core-
351345
- name: 'Install Python requirements'
352346
if: steps.pipcache.outputs.cache-hit != 'true'
353347
run: |
@@ -365,11 +359,13 @@ jobs:
365359
- uses: actions/checkout@v4
366360
- name: Set up Python 3
367361
uses: actions/setup-python@v5
362+
id: pipcache
368363
with:
369364
python-version: |
370365
3.10
371366
cache: 'pip'
372367
- name: 'Install Python requirements'
368+
if: steps.pipcache.outputs.cache-hit != 'true'
373369
run: |
374370
pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade
375371
- name: 'Run ansible-test units test cases'
@@ -385,12 +381,14 @@ jobs:
385381
- uses: actions/checkout@v4
386382
- name: Set up Python 3
387383
uses: actions/setup-python@v5
384+
id: pipcache
388385
with:
389386
python-version: |
390387
3.12
391388
3.13
392389
cache: 'pip'
393390
- name: 'Install Python requirements'
391+
if: steps.pipcache.outputs.cache-hit != 'true'
394392
run: |
395393
pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade
396394
- name: 'Run ansible-test integration test cases'
@@ -413,6 +411,8 @@ jobs:
413411
3.12
414412
3.13
415413
cache: 'pip'
414+
415+
## create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml
416416
- name: 'Install Python & Ansible requirements'
417417
run: |
418418
pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade
@@ -436,6 +436,8 @@ jobs:
436436
python-version: |
437437
3.10
438438
cache: 'pip'
439+
440+
# create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml
439441
- name: 'Install Python & Ansible requirements'
440442
run: |
441443
pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade
@@ -473,10 +475,12 @@ jobs:
473475
- uses: actions/checkout@v4
474476
- name: Set up Python 3
475477
uses: actions/setup-python@v5
478+
id: pipcache
476479
with:
477480
python-version: ${{ matrix.python }}
478481
cache: 'pip'
479482
- name: 'Install tox'
483+
if: steps.pipcache.outputs.cache-hit != 'true'
480484
run: |
481485
pip install tox tox-gh-actions --upgrade
482486
- name: "Run pytest via tox for ${{ matrix.python }}"

0 commit comments

Comments
 (0)