Skip to content

Commit 15895f8

Browse files
authored
CI: Use a cache for pre-commit (#10479)
* Use a cache for pre-commit * Use .pre-commit-config from common * Move operation until *after* submodule is fetched 🤦 * Use a more descriptive cache key
1 parent 02b7ce0 commit 15895f8

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
@@ -42,13 +42,26 @@ jobs:
4242
- checkout
4343
- run: git submodule sync
4444
- run: git submodule update --init
45+
# Recipe: https://pre-commit.com/#managing-ci-caches
46+
- run:
47+
name: Combine pre-commit config and python versions for caching
48+
command: |
49+
cp common/pre-commit-config.yaml pre-commit-cache-key.txt
50+
python --version --version >> pre-commit-cache-key.txt
51+
- restore_cache:
52+
keys:
53+
- pre-commit-cache-{{ checksum "pre-commit-cache-key.txt" }}
4554
- run: pip install --user 'tox<5'
4655
- run: tox -e pre-commit
4756
- run: tox -e migrations
4857
- node/install:
4958
node-version: '10.17.0'
5059
- run: npm ci
5160
- run: tox -e eslint
61+
- save_cache:
62+
key: pre-commit-cache-{{ checksum "pre-commit-cache-key.txt" }}
63+
paths:
64+
- ~/.cache/pre-commit
5265

5366
workflows:
5467
version: 2

0 commit comments

Comments
 (0)