Repository navigation
ci: keep Go's module and build caches between Lorx jobs - #100
Conversation
Every Go job started from a bare golang:1.25 container: it downloaded every module and compiled every package from nothing (vet 96.8 s and build 98.7 s on 2026-10-17). Long jobs hold the Lorx server longer, and that server, an e2-small, peaked at 282% CPU and cancelled running jobs. vet, build, lint and test now point GOMODCACHE and GOCACHE (and, for lint, GOLANGCI_LINT_CACHE) at directories under .cache/ in the checkout. They name those directories in cache:, which Lorx keeps between jobs as volumes per repository, directory and image. ./... skips dot-directories, and .cache/ is git-ignored. fmt stays uncached, because gofmt -l . would walk the module cache. bit ci check: valid, 5 jobs in 3 levels.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates the Lorx CI workflow to persist Go module, build, and golangci-lint caches under git-ignored .cache directories, configures the corresponding environment variables, and leaves fmt uncached to avoid traversing the module cache. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Lorx's step cache keys every step on the whole checkout, so a docs-only push re-ran all five Go jobs. Each job now names the paths it depends on: Go files, go.mod and go.sum, pkg/, internal/, cmd/ and testdata/ (the embedded migrations and test fixtures live there), the lint config and the CI file. docs/, charts/, selfhost/ and the READMEs run none of them. bit ci check: valid, 5 jobs, 5 path-filtered.
Keeps Go's module downloads and compiled packages between Lorx CI jobs, so each job stops starting from nothing.
Why
Every Go job started from a bare
golang:1.25container: it downloaded every module and compiled every package from nothing. On 2026-10-17 vet took 96.8 s and build 98.7 s. Long jobs hold the Lorx server longer, and that server (lorx-1, an e2-small) peaked at 282% CPU and cancelled running jobs (HAL-3404).How Lorx caches
A job's
cache:directories are paths inside the checkout. Each is mounted at/work/<dir>from a volume named after the repository, the directory and the image. Volumes unused for a week are removed.Change
GOMODCACHE=/work/.cache/gomodandGOCACHE=/work/.cache/gobuild, withcache: [.cache/gomod, .cache/gobuild].GOLANGCI_LINT_CACHE=/work/.cache/golangci..cache/is safe:./...skips it as a dot-directory, and it is already git-ignored.gofmt -l .would walk the module cache, and it takes a second anyway.Paths: skip the Go jobs when no Go input changed
Lorx's step cache keys every step on the whole checkout, so any change, a README included, re-runs every step; it skips a step only when nothing at all changed. A job's
paths:decides whether it runs at all. Each Go job now runs only when a change touches**/*.go,go.mod,go.sum,pkg/**,internal/**,cmd/**,testdata/**,.golangci.ymlor.lorx/**. That covers everything Go reads: the migrations embedded frompkg/db/migrations, bothtestdatafolders, the lint config and this file. A push touching onlydocs/,charts/,selfhost/or the READMEs runs none of them.The three layers together:
pathsskips the Go jobs;Verification
bit ci check: valid, 1 workflow, 5 jobs in 3 levels, 5 path-filtered.Closes HAL-3505
Summary by Sourcery
Speed up Go CI by reusing dependency and compilation caches and skipping validation for unrelated changes.
Enhancements: