Skip to content
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
46 changes: 30 additions & 16 deletions .github/workflows/check-runtime-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,29 @@ jobs:
- name: Load common environment variables via env file
run: cat .github/env >> $GITHUB_ENV

# Snapshot lookup uses a deliberately-non-matching primary `key:` so
# `restore-keys` always falls through to the most recent dated entry.
# With `lookup-only` the snapshot isn't restored — we just decide whether
# to regenerate. `cache-matched-key` is empty iff nothing was found, which
# is also the case on the daily `schedule` (lookup skipped) so the
# snapshot is force-refreshed nightly.
# The lookup is date-bounded because an unbounded prefix restore would
# let a stale PR-scoped snapshot shadow fresh dev-scoped ones forever.
# `cache-matched-key` is empty on a miss and on the nightly `schedule`
# (lookup skipped), forcing a snapshot refresh.
- name: Compute snapshot date window
id: dates
shell: bash
run: |
echo "today=$(/bin/date -u '+%Y%m%d')" >> "$GITHUB_OUTPUT"
echo "yesterday=$(/bin/date -u -d '1 day ago' '+%Y%m%d')" >> "$GITHUB_OUTPUT"
echo "daybefore=$(/bin/date -u -d '2 days ago' '+%Y%m%d')" >> "$GITHUB_OUTPUT"

- name: Check if snapshot exists in cache
id: cache-restore
if: github.event_name != 'schedule'
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
with:
lookup-only: true
path: snapshot.raw
key: try-runtime-snapshot-${{ matrix.runtime.name }}
key: try-runtime-snapshot-${{ matrix.runtime.name }}-${{ steps.dates.outputs.today }}
restore-keys: |
try-runtime-snapshot-${{ matrix.runtime.name }}-
try-runtime-snapshot-${{ matrix.runtime.name }}-${{ steps.dates.outputs.yesterday }}
try-runtime-snapshot-${{ matrix.runtime.name }}-${{ steps.dates.outputs.daybefore }}
fail-on-cache-miss: false

- name: Install just
Expand Down Expand Up @@ -175,18 +182,12 @@ jobs:
sleep 10
done

- name: Get Date
id: get-date
if: steps.cache-restore.outputs.cache-matched-key == ''
run: echo "today=$(/bin/date -u "+%Y%m%d")" >> "$GITHUB_OUTPUT"
shell: bash

- name: Save snapshot to cache
if: steps.cache-restore.outputs.cache-matched-key == ''
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
with:
path: snapshot.raw
key: try-runtime-snapshot-${{ matrix.runtime.name }}-${{ steps.get-date.outputs.today }}
key: try-runtime-snapshot-${{ matrix.runtime.name }}-${{ steps.dates.outputs.today }}

check-migrations:
name: check-migration (${{ matrix.runtime.name }})
Expand Down Expand Up @@ -231,11 +232,24 @@ jobs:
if: steps.try-runtime-cache.outputs.cache-hit != 'true'
run: just download-try-runtime

# Same 3-day window as prepare-snapshots: never restore a snapshot more
# than two days old, whatever ref scope it lives in.
- name: Compute snapshot date window
id: dates
shell: bash
run: |
echo "today=$(/bin/date -u '+%Y%m%d')" >> "$GITHUB_OUTPUT"
echo "yesterday=$(/bin/date -u -d '1 day ago' '+%Y%m%d')" >> "$GITHUB_OUTPUT"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just out of curiosity, what if prepare-snapshots: runs before midnight and check-migrations after midnight?

echo "daybefore=$(/bin/date -u -d '2 days ago' '+%Y%m%d')" >> "$GITHUB_OUTPUT"

- name: Restore snapshot from cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
with:
path: snapshot.raw
key: try-runtime-snapshot-${{ matrix.runtime.name }}-
key: try-runtime-snapshot-${{ matrix.runtime.name }}-${{ steps.dates.outputs.today }}
restore-keys: |
try-runtime-snapshot-${{ matrix.runtime.name }}-${{ steps.dates.outputs.yesterday }}
try-runtime-snapshot-${{ matrix.runtime.name }}-${{ steps.dates.outputs.daybefore }}
fail-on-cache-miss: true

- name: Run ${{ matrix.runtime.name }} Runtime Checks
Expand Down
Loading