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

## Unreleased

### Fixed

- restore the GitHub cache before automatic configuration and `mk_all-check`, so those steps can reuse cached dependencies and build artifacts

## v1.6.1 - 2026-10-02

### Changed
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ however if you encounter an issue when using a different runner, please still op

## Caching `.lake` directory with GitHub's `actions\cache`
By default, `lean-action` uses [`actions\cache`](https://github.com/actions/cache) to cache the `.lake` directory and speed up builds.
The GitHub cache is restored before automatic configuration and `mk_all-check`, so those steps can reuse cached dependencies and build artifacts.

> [!NOTE]
GitHub caching is distinct from Mathlib caching with `lake exe cache get`
Expand Down
18 changes: 9 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@ runs:
shell: bash
working-directory: ${{ inputs.lake-package-directory }}

- uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
if: ${{ inputs.use-github-cache == 'true' }}
with:
path: ${{ inputs.lake-package-directory }}/.lake
# cache key includes the operating system, the architecture (X86, X64, ARM, ARM64), the Lake manifest, and the git commit hash
key: lake-${{ runner.os }}-${{ runner.arch}}-${{ hashFiles(format('{0}/lean-toolchain', inputs.lake-package-directory)) }}-${{ hashFiles(format('{0}/lake-manifest.json', inputs.lake-package-directory)) }}-${{ github.sha }}
# if no cache hit, fall back to the cache from previous commit
restore-keys: lake-${{ runner.os }}-${{ runner.arch}}-${{ hashFiles(format('{0}/lean-toolchain', inputs.lake-package-directory)) }}-${{ hashFiles(format('{0}/lake-manifest.json', inputs.lake-package-directory)) }}

- name: configure `lean-action`
id: config
env:
Expand Down Expand Up @@ -260,15 +269,6 @@ runs:
shell: bash
working-directory: ${{ inputs.lake-package-directory }}

- uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
if: ${{ inputs.use-github-cache == 'true' }}
with:
path: ${{ inputs.lake-package-directory }}/.lake
# cache key includes the operating system, the architecture (X86, X64, ARM, ARM64), the Lake manifest, and the git commit hash
key: lake-${{ runner.os }}-${{ runner.arch}}-${{ hashFiles(format('{0}/lean-toolchain', inputs.lake-package-directory)) }}-${{ hashFiles(format('{0}/lake-manifest.json', inputs.lake-package-directory)) }}-${{ github.sha }}
# if no cache hit, fall back to the cache from previous commit
restore-keys: lake-${{ runner.os }}-${{ runner.arch}}-${{ hashFiles(format('{0}/lean-toolchain', inputs.lake-package-directory)) }}-${{ hashFiles(format('{0}/lake-manifest.json', inputs.lake-package-directory)) }}

- name: detect mathlib
# only detect Mathlib if the user did not provide the mathlib-cache input
if: ${{ inputs.use-mathlib-cache == 'auto' }}
Expand Down
Loading