Cache never hits
See original GitHub issueHi there
I’m running a molecule based Ansible role test via Tox, itself installed by pip. Hence trying to cache pip, tox and molecule. The cache never hit. To be sure I ran the job twice in a row with just a space added in the README.
First one
Second one
Here’s the workflow definition
name: Tests
on:
push:
tags:
- "*"
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.7]
steps:
- uses: actions/checkout@v2
- name: Setup git credentials
uses: fusion-engineering/setup-git-credentials@v2
with:
credentials: ${{secrets.GIT_CREDENTIALS}}
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Cache pip
uses: actions/cache@v1
id: cache-pip
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Tox
if: steps.cache-pip.outputs.cache-hit != 'true'
run: pip install tox
- name: Cache Tox
uses: actions/cache@v1
with:
path: .tox
key: ${{ runner.os }}-tox-${{ hashFiles('**/tox.ini') }}
restore-keys: |
${{ runner.os }}-tox-
- name: Cache Molecule
uses: actions/cache@v1
with:
path: ~/.cache/molecule
key: ${{ runner.os }}-molecule-${{ hashFiles('**/requirements.yml') }}
restore-keys: |
${{ runner.os }}-molecule-
- name: Run Tox
run: tox
And the tox.ini
which should be enough to reproduce
[tox]
envlist = molecule
skipsdist = true
[testenv:molecule]
deps =
ansible-lint
flake8
molecule[docker]~=3.0
netaddr
requests
testinfra
yamllint
passenv =
HOME
SSH_AUTH_SOCK
TERM
TTY
commands = echo molecule {posargs:test}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Second Level Cache never hits using, spring3, hibernate4 ...
The entity loading goes to 2st level cache, then 2nd level cache only to hit the db if there isn't such entity already...
Read more >sccache never has cache hits when invoked through cargo #193
I have Rust 1.22 nightly installed. I installed sccache with cargo install sccache (sccache 0.2.1). I followed instruction to set up ...
Read more >How to Deal with Common Causes of a Poor Cache hit Ratio
The cache hit ratio (or hit ratio for short) is the ratio of hits to cacheable requests (hits and misses combined).
Read more >When They Occur (& How to Increase Cache Hit Ratio)
Learn why it is important to have a caching policy, when cache miss and cache hit occur, how cache hit ratio is calculated...
Read more >cache-control, no-cache, no-store, max-age, ETag and etc.
Caching on the Web Explained with simple examples of how HTTP Caching works, including Proxy Caching and CDNs, and how the Cache -Control ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
👋 @nvivobume This type of behavior is typically caused by the cache scope. Details can be found in issue https://github.com/actions/cache/issues/79 and in the docs. If the docs aren’t clear or you still see the issue, please let me know.
@crane-hiromu Are the two screenshots from different tags? Is the
develop
branch the default branch for your repo? Two workflows triggered from tags won’t be able to share caches (same scoping issue I mention above), but can read from caches created by your default branch. I would suggest making sure the changes are in the default branch and a workflow is triggered from the default branch to create the cache.Indeed, I c/ced my “tests.yml” to make a “make_cache.yml” workflow
And it works. “make_cache” is really fast, so doesn’t add much overhead on commits