Skip to content

ci: reuse cached build for constants check via artifact#6

Open
huth-stacks wants to merge 1 commit into
developfrom
ci/P6-constants-check-reuse
Open

ci: reuse cached build for constants check via artifact#6
huth-stacks wants to merge 1 commit into
developfrom
ci/P6-constants-check-reuse

Conversation

@huth-stacks

Copy link
Copy Markdown
Owner

What

Generate the constants JSON during the nextest-archive build (where stacks-inspect is already compiled) and pass it to the constants-check job via artifact, eliminating a redundant 4-minute compilation.

Why

constants-check.yml runs cargo run --bin stacks-inspect -- dump-consts which compiles stacks-inspect and all its dependencies from scratch (4m10s). The nextest-archive job in create-cache.yml already compiles the entire workspace. By running dump-consts there and uploading the JSON as an artifact, we eliminate the redundant compilation entirely.

The Change

File 1: .github/workflows/create-cache.yml (+11 lines)
Add two steps at the end of the nextest-archive job:

  • "Generate constants artifact": cargo run --bin stacks-inspect -- dump-consts > constants.json
  • "Upload constants artifact": actions/upload-artifact@v4 with name constants-dump, 1-day retention

File 2: .github/workflows/constants-check.yml (-16/+4 lines)
Replace Rust toolchain setup + cargo run with:

  • "Download constants artifact": actions/download-artifact@v4 with name constants-dump
  • "Compare expected constants JSON": diff constants.json ./sample/expected_consts.json

~15 lines changed across 2 files.

How to Verify

  • constants-check job should complete in <30 seconds (download + diff)
  • The diff output should match what the old approach produced

Metrics to Track

Metric Baseline Expected
constants-check duration 4m10s ~10-15s
nextest-archive duration ~15m33s +~10s (dump-consts on already-compiled workspace)

Security Checklist

  • No new permissions granted
  • No secrets in artifact — only constants JSON (public blockchain parameters)
  • Artifact retention set to 1 day (minimal storage)
  • Uses actions/upload-artifact@v4 and actions/download-artifact@v4 (already used elsewhere in CI)

Part of CI Optimization Series

PR 6 of 7. Most complex change in the series. Expected impact: ~4 min off total pipeline.

@huth-stacks huth-stacks added the no changelog Skip changelog fragment check label Mar 24, 2026
@huth-stacks huth-stacks reopened this Mar 24, 2026
@huth-stacks huth-stacks reopened this Mar 24, 2026
Instead of compiling stacks-inspect from scratch (4+ minutes), the
nextest-archive job now generates the constants JSON and uploads it
as an artifact. The constants-check job downloads and diffs it,
reducing the check from 4 minutes to ~10 seconds.

Also adds create-cache to constants-check's needs in ci.yml so the
artifact is available before the download step runs.
@huth-stacks huth-stacks force-pushed the ci/P6-constants-check-reuse branch from 203464a to 713d343 Compare March 24, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog Skip changelog fragment check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant