为什么Github的setup操作的缓存仍然使pip安装所有依赖项?
我有一个简单的工作流程
name: Python Testing
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
permissions:
contents: read
jobs:
coverage_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.6"
cache: 'pip' # caching pip dependencies
- run: pip install -r requirements.txt --use-deprecated=legacy-resolver从日志上看,这是一个缓存命中
Successfully set up CPython (3.6.15)
/opt/hostedtoolcache/Python/3.6.15/x64/bin/pip cache dir
/home/runner/.cache/pip
Received 123461741 of 123461741 (100.0%), 111.2 MBs/sec
Cache Size: ~118 MB (123461741 B)
/usr/bin/tar --use-compress-program unzstd -xf /home/runner/work/_temp/a5d8f986-ce6b-424f-8de9-c082916cdb2f/cache.tzst -P -C /home/runner/work/backend/backend
Cache restored successfully
Cache restored from key: setup-python-Linux-20.04-Ubuntu-python-3.6.15-pip-d0b220da2d89ebae7a0978e97e9d1ce87061e5e2e0f5d3d242c2770b7f983de6但是python依赖项已经安装。
Collecting Flask-Cors==3.0.9
Using cached Flask_Cors-3.0.9-py2.py3-none-any.whl (14 kB)
Collecting Flask-GraphQL==2.0.1
....我希望依赖关系已经存在,并返回如下内容
Requirement already satisfied: Flask-Cors==3.0.9 in
....发布于 2022-10-19 04:10:46
我使用它来缓存依赖项,在这一步之前,您签出回购,加载缓存dep,然后安装或执行您的操作。
- name: Load Cached Virtualenv
id: cached-pip-wheels
uses: actions/cache@v3
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}请记住,这是在使用poetry.lock,您需要用requirements.txt替换该文件
https://stackoverflow.com/questions/74119692
复制相似问题