Skip to content

Commit 88bfa06

Browse files
committed
Use a cache for pre-commit
1 parent b34b0c6 commit 88bfa06

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.circleci/config.yml

+13
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ jobs:
4040
- image: 'cimg/python:3.10'
4141
steps:
4242
- checkout
43+
# Recipe: https://pre-commit.com/#managing-ci-caches
44+
- run:
45+
name: Combine precommit config and python versions for caching
46+
command: |
47+
cp .pre-commit-config.yaml pre-commit-cache-key.txt
48+
python --version --version >> pre-commit-cache-key.txt
49+
- restore_cache:
50+
keys:
51+
- v1-pc-cache-{{ checksum "pre-commit-cache-key.txt" }}
4352
- run: git submodule sync
4453
- run: git submodule update --init
4554
- run: pip install --user 'tox<5'
@@ -49,6 +58,10 @@ jobs:
4958
node-version: '10.17.0'
5059
- run: npm ci
5160
- run: tox -e eslint
61+
- save_cache:
62+
key: v1-pc-cache-{{ checksum "pre-commit-cache-key.txt" }}
63+
paths:
64+
- ~/.cache/pre-commit
5265

5366
workflows:
5467
version: 2

0 commit comments

Comments
 (0)