ci(dialyzer): cache PLT and split build/analyze steps#243
Merged
Conversation
Pin plt_core_path and plt_local_path to priv/plts/ in mix.exs so the PLT lands in a stable, cache-able directory. Add a Restore PLT cache step in the dialyzer job (actions/cache@v4, keyed on OS/Elixir/OTP/mix.lock) so the ~3-minute PLT build is paid only on the first run or after a dependency change. Split the single 'mix dialyzer' call into a separate 'Build PLT' step and 'Run dialyzer' step so CI logs show build vs. analysis time independently. Also drop :mix from plt_add_apps — lib/ has no runtime references to Mix.*, so the extra PLT coverage is dead weight. Expected result: dialyzer job drops from ~3m30s to ~45-60s on cache hit.
tasks/ uses Mix.raise/1, Mix.shell/0, and Mix.Task.run/1 — all compiled under the :dev env that dialyzer analyses. Dropping :mix caused 18 unknown_function errors. Put it back.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cache the Dialyzer PLT in CI to cut job time from ~3m30s to <60s
Plan:
.agents/plans/A38-dialyzer-plt-cache.mdGoal
Cache the Dialyzer PLT files in GitHub Actions so the dialyzer job runs in
under 60 seconds on cache hits instead of ~3m30s every run.
Root cause
The
dialyzerjob had no PLT cache and no stable PLT path. Every runrebuilt the entire OTP/Elixir/ex_unit PLT from scratch (~2m45s), then
ran analysis on top of that (~15s). The PLT build cost was paid even
when nothing changed.
Success criteria
mix format --check-formattedpassesmix compile --warnings-as-errorspassesmix testpasses — 55 doctests, 51 properties, 1771 tests, 0 failuresmix dialyzerstep < 60sChanges
mix.exs— pinplt_core_path/plt_local_pathtopriv/plts/so thePLT files land in a deterministic, cache-able directory. Also drop
:mixfrom
plt_add_apps—lib/has no runtime references toMix.*(onlytasks/does, and that path is excluded from the productionelixirc_paths/1)..gitignore— exclude/priv/plts/so PLT build artefacts are never committed..github/workflows/ci.yml— in thedialyzerjob:Restore PLT cachestep (actions/cache@v4) immediately afterinstall-deps. Cache key includes OS, Elixir version, OTP version, andmix.lockhash. Therestore-keysfallback means amix.lockbumptriggers an incremental PLT update instead of a full rebuild.
mix dialyzerstep intoBuild PLT(mix dialyzer --plt)and
Run dialyzer(mix dialyzer) so CI logs show build vs. analysistime separately.
Verification
Out of scope (intentional)
mix testor other CI jobs