Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Changed

- set `MATHLIB_CACHE_GET_URL` to `https://cache.mathlib.org/mathlib4` for
`lake exe cache get`, so Mathlib cache clients that read this variable download from
cache.mathlib.org. A value that the workflow sets takes precedence. An empty value
unsets the variable, so the cache client uses its own default endpoint

### Fixed

- pass `--no-modify-path` to `elan-init` so installing elan no longer edits the
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ Saving is skipped when the exact cache key was restored.
> [!NOTE]
GitHub caching is distinct from Mathlib caching with `lake exe cache get`

### Mathlib cache endpoint
`lean-action` runs `lake exe cache get` with `MATHLIB_CACHE_GET_URL` set to `https://cache.mathlib.org/mathlib4`.
Mathlib cache clients that read this variable download from that URL. Older clients ignore it.
To use a different endpoint, set `MATHLIB_CACHE_GET_URL` in the `env` of your workflow, job, or step.
`lean-action` keeps that value.
To use the cache client's default endpoint, set `MATHLIB_CACHE_GET_URL` to an empty string.
`lean-action` then unsets the variable before it runs `lake exe cache get`.

### Cache keys
`lean-action` uses [cache keys](https://github.com/actions/cache?tab=readme-ov-file#creating-a-cache-key) to save and restore caches.

Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@ runs:
run: |
: Get Mathlib Cache
echo "::group::Mathlib Cache"
# Use cache.mathlib.org unless the workflow sets `MATHLIB_CACHE_GET_URL`.
# The cache client reads an empty value as a URL, so unset it to get the client's default.
if [ -z "${MATHLIB_CACHE_GET_URL+x}" ]; then
export MATHLIB_CACHE_GET_URL="https://cache.mathlib.org/mathlib4"
elif [ -z "$MATHLIB_CACHE_GET_URL" ]; then
unset MATHLIB_CACHE_GET_URL
fi
lake exe cache get
echo "::endgroup::"
echo
Expand Down
Loading