Skip to content

ci: extract install-cvc5, install-z3, restore-lake-cache into composite actions#1137

Open
tautschnig wants to merge 4 commits into
mainfrom
tautschnig/reusable-ci-workflows
Open

ci: extract install-cvc5, install-z3, restore-lake-cache into composite actions#1137
tautschnig wants to merge 4 commits into
mainfrom
tautschnig/reusable-ci-workflows

Conversation

@tautschnig
Copy link
Copy Markdown
Contributor

The same ~15-line blocks for installing cvc5, installing z3, and restoring the lake cache were duplicated across ci.yml's three jobs (build_and_test_lean, check_pending_python, build_python), cbmc.yml, and python-fuzz.yml. Robin asked for this to be consolidated as part of the #984 review (flagged non-blocking there, handled here).

Introduce three composite actions under .github/actions/:

  • install-cvc5: downloads the static cvc5 release zip, makes the binary available either on $GITHUB_PATH ('path', default) or in /usr/local/bin ('system'). Version defaults to 1.2.1.

  • install-z3: same shape for z3, version defaults to 4.15.2. This fixes a latent bug: cbmc.yml and build_and_test_lean used different aarch64 archive names ('arm64-glibc-2.34' vs. 'arm64-win'); the consolidated action uses the correct glibc-2.34 one for both.

  • restore-lake-cache: wraps actions/cache/restore@v5 with the established key pattern lake-----<all .st>- plus the three fallback keys dropping each trailing component. Exposes a 'fail-on-cache-miss' input for jobs that depend on a cache saved for the same SHA by build_and_test_lean.

Rewire ci.yml and cbmc.yml to use the new actions:

  • ci.yml: build_and_test_lean: install-cvc5, install-z3, restore-lake-cache. check_pending_python: install-cvc5 (system), restore-lake-cache (fail-on-cache-miss: true).
    build_python: install-cvc5 (system), restore-lake-cache
    (fail-on-cache-miss: true).
    (The pip-based z3 install here is deliberately left as-is —
    it is a different install flow.)
  • cbmc.yml:
    install-cvc5, install-z3, restore-lake-cache (fail-on-cache-miss: true).

Net change: -108 lines of duplicated shell, +17 lines of action usage across the two workflow files, with the reusable definitions ready to be adopted by python-fuzz.yml and any future workflows.

actionlint reports no new warnings (the pre-existing save-always warning on cbmc.yml line 22 is unrelated).

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…te actions

The same ~15-line blocks for installing cvc5, installing z3, and
restoring the lake cache were duplicated across ci.yml's three jobs
(build_and_test_lean, check_pending_python, build_python), cbmc.yml,
and python-fuzz.yml. Robin asked for this to be consolidated as part
of the #984 review (flagged non-blocking there, handled here).

Introduce three composite actions under .github/actions/:

- install-cvc5: downloads the static cvc5 release zip, makes the binary
  available either on $GITHUB_PATH ('path', default) or in
  /usr/local/bin ('system'). Version defaults to 1.2.1.

- install-z3: same shape for z3, version defaults to 4.15.2. This
  fixes a latent bug: cbmc.yml and build_and_test_lean used different
  aarch64 archive names ('arm64-glibc-2.34' vs. 'arm64-win'); the
  consolidated action uses the correct glibc-2.34 one for both.

- restore-lake-cache: wraps actions/cache/restore@v5 with the
  established key pattern
    lake-<os>-<arch>-<toolchain>-<manifest>-<all .st>-<sha>
  plus the three fallback keys dropping each trailing component.
  Exposes a 'fail-on-cache-miss' input for jobs that depend on a
  cache saved for the same SHA by build_and_test_lean.

Rewire ci.yml and cbmc.yml to use the new actions:

- ci.yml:
    build_and_test_lean: install-cvc5, install-z3, restore-lake-cache.
    check_pending_python: install-cvc5 (system), restore-lake-cache
      (fail-on-cache-miss: true).
    build_python:        install-cvc5 (system), restore-lake-cache
      (fail-on-cache-miss: true).
      (The pip-based z3 install here is deliberately left as-is —
      it is a different install flow.)
- cbmc.yml:
    install-cvc5, install-z3, restore-lake-cache (fail-on-cache-miss: true).

Net change: -108 lines of duplicated shell, +17 lines of action usage
across the two workflow files, with the reusable definitions ready to
be adopted by python-fuzz.yml and any future workflows.

actionlint reports no new warnings (the pre-existing save-always
warning on cbmc.yml line 22 is unrelated).

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR consolidates repeated CI workflow logic for installing SMT solvers (cvc5, z3) and restoring the Lean .lake cache by introducing reusable composite actions under .github/actions/, then rewiring the existing CI workflows to use them.

Changes:

  • Added composite actions: install-cvc5, install-z3, and restore-lake-cache.
  • Updated .github/workflows/ci.yml and .github/workflows/cbmc.yml to call the new actions instead of duplicating shell blocks.
  • Standardized z3 aarch64 archive handling via the shared installer action.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/ci.yml Replaces duplicated cvc5/z3 install and lake cache restore blocks with composite action usage across relevant jobs.
.github/workflows/cbmc.yml Replaces duplicated cvc5/z3 install and lake cache restore blocks with composite action usage.
.github/actions/restore-lake-cache/action.yml New composite action wrapping actions/cache/restore@v5 with the repo’s standard lake cache key pattern.
.github/actions/install-z3/action.yml New composite action that downloads/unpacks z3 for x86_64/aarch64 and exposes it via PATH or /usr/local/bin.
.github/actions/install-cvc5/action.yml New composite action that downloads/unpacks static cvc5 for x86_64/aarch64 and exposes it via PATH or /usr/local/bin.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/actions/restore-lake-cache/action.yml Outdated
Comment thread .github/actions/restore-lake-cache/action.yml Outdated
Comment thread .github/actions/install-cvc5/action.yml Outdated
tautschnig and others added 2 commits May 15, 2026 22:29
Replace stale python-fuzz.yml references with anchors to #984 (which
introduces python-fuzz.yml) and tighten the restore-lake-cache key-prefix
input description so it no longer suggests the action can serve sub-
projects with their own toolchain/manifest (the action hardcodes
hashFiles('lean-toolchain') and hashFiles('lake-manifest.json') from the
repo root).

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@shigoel shigoel left a comment

Choose a reason for hiding this comment

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

Nice cleanup — the z3 aarch64 bug fix is a good catch. One behavioral concern flagged inline.

Comment thread .github/actions/restore-lake-cache/action.yml
…ty net

The pre-PR ci.yml and cbmc.yml deliberately omitted restore-keys for
jobs that used fail-on-cache-miss: true, so those jobs would only
accept the exact-SHA cache saved upstream by build_and_test_lean (per
the soundness argument in #952: stale .lake directories produce
incorrect CI results because Lake doesn't track external state, so
cross-SHA cache reuse is unsafe for jobs that depend on Python/cvc5).

The consolidated action always emitted the three fallback keys, which
silently broke the safety net: a stale prefix match would satisfy the
restore step and fail-on-cache-miss would never trigger.

Restore the original behaviour by adding a use-restore-keys input
(default "true") to the action and gating the restore step into two
if-branches, one with the three fallback keys and one with no
restore-keys at all. The cache-hit output is the OR of the two
branches' outputs. The three downstream callers (ci.yml's
check_pending_python and build_python, plus cbmc.yml) now pass
use-restore-keys: "false" alongside fail-on-cache-miss: "true".

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code Waiting-For-Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants