Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • pleroma pleroma
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 646
    • Issues 646
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 88
    • Merge requests 88
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PleromaPleroma
  • pleromapleroma
  • Merge requests
  • !3398

Cache GitLab CI based on mix.lock

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Alex Gleason requested to merge alexgleason/pleroma:gitlab-ci-mix-lock into develop Apr 27, 2021
  • Overview 10
  • Commits 1
  • Pipelines 3
  • Changes 1

Pleroma's CI is slow. This change makes is considerably faster. I'm using it in my fork and figured I'd share.

The following directories are cacheable:

  • deps
  • _build

Currently we invalidate cache based on the commit hash ($CI_COMMIT_REF_SLUG). In other words, things are only cached across jobs of the same pipeline.

Instead of using the commit hash, we can use the mix.lock file itself as the key. As long as mix.lock is the same, we can safely assume the deps will be the same, and cache them across multiple pipelines.

_build is where it gets trickier. Building dependencies (phoenix, ecto, pbkdf2, etc) adds considerable build time. But we can cache _build with mix.lock too, and dependencies don't need to be recompiled unless mix.lock changes. The downside is that Pleroma's build is also cached in _build. Minor inconsistencies could potentially arise from that, but mix is smart enough to deal with it, so I think it's worth it for the speed boost.

Screenshot_from_2021-04-27_12-13-54

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: gitlab-ci-mix-lock