Skip to content

Commit f520399

Browse files
authored
Merge pull request #86 from valkey-io/aiven-sal/cache
ci: cache docker layers and avoid re-downloading them for each job
2 parents cd24489 + f90519d commit f520399

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/integration.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,29 @@ jobs:
5050
pip install -r dev_requirements.txt
5151
invoke linters
5252
53+
populate-cache:
54+
runs-on: ubuntu-latest
55+
timeout-minutes: 60
56+
name: Update docker cache
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Cache docker images
60+
id: custom-cache
61+
uses: actions/cache@v3
62+
with:
63+
path: ./custom-cache/
64+
key: custom-cache
65+
- if: ${{ steps.custom-cache.outputs.cache-hit != 'true' || github.event_name == 'schedule' }}
66+
name: Update Cache
67+
run: |
68+
mkdir -p ./custom-cache/
69+
docker compose --profile all build
70+
docker pull valkey/valkey:latest
71+
docker save valkey-py-stunnel:latest valkey-py-cluster:latest valkey/valkey:latest -o ./custom-cache/all.tar
72+
5373
run-tests:
5474
runs-on: ubuntu-latest
75+
needs: [populate-cache]
5576
timeout-minutes: 60
5677
strategy:
5778
max-parallel: 15
@@ -70,6 +91,17 @@ jobs:
7091
with:
7192
python-version: ${{ matrix.python-version }}
7293
cache: 'pip'
94+
95+
- name: Cache docker images
96+
id: custom-cache
97+
uses: actions/cache@v3
98+
with:
99+
path: ./custom-cache/
100+
fail-on-cache-miss: true
101+
key: custom-cache
102+
- name: Use Cache
103+
run: docker image load -i ./custom-cache/all.tar
104+
73105
- name: run tests
74106
run: |
75107
pip install -U setuptools wheel
@@ -115,6 +147,17 @@ jobs:
115147
- uses: actions/setup-python@v5
116148
with:
117149
python-version: 3.9
150+
151+
- name: Cache docker images
152+
id: custom-cache
153+
uses: actions/cache@v3
154+
with:
155+
path: ./custom-cache/
156+
fail-on-cache-miss: true
157+
key: custom-cache
158+
- name: Use Cache
159+
run: docker image load -i ./custom-cache/all.tar
160+
118161
- name: Run installed unit tests
119162
run: |
120163
bash .github/workflows/install_and_test.sh ${{ matrix.extension }}

0 commit comments

Comments
 (0)