Skip to content

CI: stop recompiling openssl-sys on every Windows/macOS run (pin artifact mtimes)#14971

Merged
reaperhulk merged 1 commit into
mainfrom
claude/magical-hopper-1R1Vj-ossl-mtimes
Jun 7, 2026
Merged

CI: stop recompiling openssl-sys on every Windows/macOS run (pin artifact mtimes)#14971
reaperhulk merged 1 commit into
mainfrom
claude/magical-hopper-1R1Vj-ossl-mtimes

Conversation

@alex
Copy link
Copy Markdown
Member

@alex alex commented Jun 7, 2026

What

After downloading the prebuilt OpenSSL artifacts on Windows and macOS, set every extracted file's mtime to the artifact's created_at (via a small .github/bin/pin_artifact_mtimes.py, fed from the download action's artifacts output).

Why

openssl-sys's build script registers cargo:rerun-if-changed on the OpenSSL include directory, which cargo evaluates by mtime. On Windows and macOS the prebuilt OpenSSL is downloaded and extracted fresh on every CI run, so identical headers get brand-new mtimes — and openssl-sys (plus everything downstream: openssl, cryptography-openssl, cryptography-cffi) recompiles on every run despite a warm rust-cache. Visible in any windows job log as Compiling openssl-sys v0.9.116 / Compiling openssl v0.10.80 (~30–45s of the build step).

The Linux jobs don't have this problem because their custom OpenSSL builds are restored by actions/cache, which preserves mtimes — which is exactly why this was a Windows/macOS-only symptom.

Why the artifact's creation time

It's the semantically right timestamp: an unchanged artifact always presents identical mtimes to cargo (cache stays valid), while a rebuilt artifact gets a new created_at and correctly triggers an openssl-sys rebuild — no staleness window, no cache-key coupling, and it's guaranteed to be in the past (a content-derived timestamp would need care not to land in the future, which would make cargo permanently dirty).

Expected impact

Removes the remaining ~30–45s of redundant compilation from every Windows job's "Build nox environment" step and the macOS equivalent. No cache key bump needed: the pinned mtimes are older than the timestamps recorded in existing cached fingerprints, so existing caches start hitting immediately — the first run on this PR should already show no Compiling openssl-sys on windows/macos.

(Complements #14968, which removes the pyo3 chain recompiles; this one targets the openssl-sys side and is independent.)

https://claude.ai/code/session_014StKTjk7GBcVdiWKimEsQb


Generated by Claude Code

openssl-sys's build script registers cargo:rerun-if-changed on the
OpenSSL include directory, which cargo evaluates by mtime. On Windows
and macOS the prebuilt OpenSSL is downloaded and extracted fresh on
every CI run, so identical headers get new mtimes and openssl-sys (and
everything downstream: openssl, cryptography-openssl, cryptography-cffi)
recompiles every run despite a warm rust-cache. The Linux jobs don't
have this problem because their OpenSSL builds are restored by
actions/cache, which preserves mtimes.

Set every extracted file's mtime to the artifact's created_at: an
unchanged artifact always looks the same to cargo, while a rebuilt
artifact gets a new timestamp and correctly triggers a rebuild.

https://claude.ai/code/session_014StKTjk7GBcVdiWKimEsQb
@reaperhulk reaperhulk merged commit 1456f5b into main Jun 7, 2026
63 checks passed
@reaperhulk reaperhulk deleted the claude/magical-hopper-1R1Vj-ossl-mtimes branch June 7, 2026 15:00
reaperhulk pushed a commit that referenced this pull request Jun 7, 2026
…low-up to #14971) (#14972)

* Pin directory mtimes too in pin_artifact_mtimes

cargo's rerun-if-changed on a directory also stats the directories
themselves (that's how it detects file deletions), and extraction
recreates them with fresh mtimes on every run. With only file mtimes
pinned, openssl-sys still recompiled on every Windows/macOS run, as
the first CI run with the previous change showed.

https://claude.ai/code/session_014StKTjk7GBcVdiWKimEsQb

* Refactor OpenSSL artifact download + mtime pinning into a reusable action

https://claude.ai/code/session_014StKTjk7GBcVdiWKimEsQb

---------

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants