Skip to content

Commit 65ef6e6

Browse files
committed
ci: use hm cache save/restore for per-image Docker caching
1 parent 739b8b5 commit 65ef6e6

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,30 +113,32 @@ jobs:
113113
/usr/bin/python3 -c "import harmont; print('harmont', harmont.__file__)"
114114
115115
- name: Restore harmont Docker cache
116-
id: docker-cache
117-
uses: actions/cache@v4
116+
uses: actions/cache/restore@v4
118117
with:
119-
path: /tmp/harmont-docker-cache.tar
120-
key: harmont-docker-${{ hashFiles('Cargo.lock') }}
118+
path: .harmont-cache/
119+
key: harmont-v1-will-never-match
121120
restore-keys: |
122-
harmont-docker-
121+
harmont-v1-
123122
124123
- name: Load cached Docker images
125-
if: steps.docker-cache.outputs.cache-hit == 'true'
126-
run: docker load -i /tmp/harmont-docker-cache.tar || true
124+
run: ./target/debug/hm cache restore .harmont-cache/
127125

128126
- name: hm run ci
129127
env:
130128
HM_NONINTERACTIVE: '1'
131129
run: ./target/debug/hm run ci
132130

133131
- name: Save harmont Docker images
132+
id: cache-manifest
134133
if: always()
135-
run: |
136-
images=$(docker images --format '{{.Repository}}:{{.Tag}}' | grep '^harmont-local/' || true)
137-
if [ -n "$images" ]; then
138-
docker save $images -o /tmp/harmont-docker-cache.tar
139-
fi
134+
run: echo "key=harmont-v1-$(./target/debug/hm cache save .harmont-cache/)" >> "$GITHUB_OUTPUT"
135+
136+
- name: Upload Docker cache
137+
if: always()
138+
uses: actions/cache/save@v4
139+
with:
140+
path: .harmont-cache/
141+
key: ${{ steps.cache-manifest.outputs.key }}
140142

141143
integration:
142144
name: docker-gated integration test

0 commit comments

Comments
 (0)