Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action cache for redis-server binary #372

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,28 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}

- name: Cache redis server binary restore
id: cache-redis-server-binary-restore
uses: actions/cache/restore@v4
with:
path: integration/redis_src/redis-server
key: "redis-server-binary-${{ hashFiles('integration/get_redis.sh') }}"

- name: Prevent redis binary rebuild
if: steps.cache-redis-server-binary-restore.outputs.cache-hit
run: "touch -m integration/redis_src/redis-server"
# Make uses modification timestamp to decide if redis-server needs to be rebuilt.
# In github actions get_redis.sh has modification time set when cloned but redis-server binary has modification
# time when it was cached (always older than clone). By updating timestamp we avoid unnecessary build.
# Cache key includes get_redis.sh file hash so there is no risk of using stale binary.

- name: Test
run: make ci

- name: Cache redis server binary save
if: steps.cache-redis-server-binary-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: integration/redis_src/redis-server
key: ${{ steps.cache-redis-server-binary-restore.outputs.cache-primary-key }}
Loading