Skip to content

Commit 2ef44dd

Browse files
committed
CI: Use year and week number cache key for -master and -latest
The commit 790ed93 ("CI: enable caching for openssl-master, libressl-master, and aws-lc-latest") assumed that caches expire after a week, but they only expire if not accessed within that period. On an active repository, the cache would be accessed on every CI run and remain permanently stale. https://github.com/actions/cache#cache-limits Include the current year and week number in the cache key for openssl-master, libressl-master, and aws-lc-latest to ensure the cached builds are refreshed weekly. http://man7.org/linux/man-pages/man1/date.1.html > %W week number of year, with Monday as first day of week > (00..53) Assisted-by: Claude:Opus 4.6
1 parent 177a1a7 commit 2ef44dd

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/test.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,21 @@ jobs:
119119
- name: repo checkout
120120
uses: actions/checkout@v7
121121

122-
# Caches not accessed within the last week are evicted.
122+
# Caches not accessed within the last week are evicted. However, if a
123+
# cache is accessed at least once a week, it can remain permanently.
124+
# Use a weekly cache key for -master and -latest builds to keep them
125+
# reasonably fresh, while stable versions use a fixed key.
123126
# https://github.com/actions/cache#cache-limits
127+
- name: Get current week
128+
id: current-week
129+
if: matrix.openssl == 'openssl-master' || matrix.openssl == 'libressl-master' || matrix.openssl == 'aws-lc-latest'
130+
run: echo "week=$(date -u '+%Y%W')" >> "$GITHUB_OUTPUT"
131+
124132
- id: cache-openssl
125133
uses: actions/cache@v6
126134
with:
127135
path: ~/openssl
128-
key: openssl-${{ runner.os }}-${{ matrix.openssl }}-${{ matrix.append-configure || 'default' }}
136+
key: openssl-${{ runner.os }}-${{ matrix.openssl }}-${{ matrix.append-configure || 'default' }}-${{ steps.current-week.outputs.week || 'default' }}
129137

130138
- name: Compile OpenSSL library
131139
if: steps.cache-openssl.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)