简介
使用circleci运行unittest时,我必须下载并安装LibreOffice。仅在未缓存的情况下,我们才能如何进行下载?
p.s。也发布在circleci支持here
上详细信息
LibreOffice下载和安装通常需要30秒钟以上的时间。
所以我打算使用 save_cache 功能here
对其进行缓存我的google search引导我何时执行 here,尽管该指南尚不清楚如何检查缓存键是否存在。
我将代码HOW_TO放在代码段下方的.circleci / config.yml中
- restore_cache:
key: cache-libreoffice
- when:
condition: <<HOW_TO check if cache key exists >>
steps:
- run:
name: install atlas Pipfile
command: |
mkdir -p /tmp/libreoffice
cd /tmp/libreoffice
wget https://download.documentfoundation.org/libreoffice/stable/6.3.3/deb/x86_64/LibreOffice_6.3.3_Linux_x86-64_deb.tar.gz
- save_cache:
key: cache-libreoffice
paths: # the paths to save to cache entry
- /tmp/libreoffice