Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

ci(teamhub): cache lint and sqlc binaries and the golangci-lint cache

shoudi zheng5592559c0294
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f3f47316..25549f10 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -102,5 +102,27 @@ jobs:
fetch-depth: 0
- uses: ./.github/actions/setup
if: needs.changes.outputs[matrix.app] == 'true'
+ # Pinned golangci-lint and sqlc binaries; building them takes about 60 s
+ # each. Their file names carry the tool and Go versions, and the key
+ # hashes the files that pin both, so a version bump misses and rebuilds.
+ - uses: actions/cache@v4
+ if: matrix.app == 'teamhub' && needs.changes.outputs[matrix.app] == 'true'
+ with:
+ path: apps/teamhub/.tools/bin
+ key: teamhub-tools-${{ runner.os }}-${{ hashFiles('apps/teamhub/Makefile', 'apps/teamhub/scripts/verify-generated.sh', 'apps/teamhub/go.mod') }}
+ # A cold golangci-lint analysis cache costs about 115 s. Pull requests
+ # restore main's latest entry; only pushes save, so they never write one.
+ - uses: actions/cache/restore@v4
+ if: matrix.app == 'teamhub' && needs.changes.outputs[matrix.app] == 'true'
+ with:
+ path: ~/.cache/golangci-lint
+ key: golangci-lint-${{ runner.os }}-${{ hashFiles('apps/teamhub/go.sum', '.golangci.yml') }}-${{ github.sha }}
+ restore-keys: |
+ golangci-lint-${{ runner.os }}-${{ hashFiles('apps/teamhub/go.sum', '.golangci.yml') }}-
- if: needs.changes.outputs[matrix.app] == 'true'
run: make check-${{ matrix.app }} BASE="$BASE"
+ - uses: actions/cache/save@v4
+ if: always() && github.event_name == 'push' && matrix.app == 'teamhub' && needs.changes.outputs[matrix.app] == 'true'
+ with:
+ path: ~/.cache/golangci-lint
+ key: golangci-lint-${{ runner.os }}-${{ hashFiles('apps/teamhub/go.sum', '.golangci.yml') }}-${{ github.sha }}
diff --git a/apps/teamhub/Makefile b/apps/teamhub/Makefile
index 1d5391b7..31760526 100644
--- a/apps/teamhub/Makefile
+++ b/apps/teamhub/Makefile
@@ -17,18 +17,26 @@ GOVULNCHECK_VERSION := v1.1.4
SQLC_VERSION := v1.29.0
GOLANGCI_LINT ?= $(TOOLS_BIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)-$(GO_TOOLCHAIN_VERSION)
GOVULNCHECK ?= $(TOOLS_BIN)/govulncheck-$(GOVULNCHECK_VERSION)-$(GO_TOOLCHAIN_VERSION)
+SQLC_BIN ?= $(TOOLS_BIN)/sqlc-$(SQLC_VERSION)-$(GO_TOOLCHAIN_VERSION)
RELIABILITY_TESTS := Test(RoomEventCatchupAndSSE|SSEClosesWhenSessionExpires|SSEClosesWhenSessionIsRevoked|SSEClosesDuringApplicationShutdown)
install:
pnpm -C ../.. install
-generate:
+generate: $(SQLC_BIN)
$(MAKE) -C ../.. contracts-generate
- SQLC_VERSION=$(SQLC_VERSION) SQLC_BIN='$(SQLC_BIN)' ./scripts/verify-generated.sh --write
+ SQLC_VERSION=$(SQLC_VERSION) SQLC_BIN='$(abspath $(SQLC_BIN))' ./scripts/verify-generated.sh --write
-sqlc-verify:
- SQLC_VERSION=$(SQLC_VERSION) SQLC_BIN='$(SQLC_BIN)' ./scripts/verify-generated.sh
+sqlc-verify: $(SQLC_BIN)
+ SQLC_VERSION=$(SQLC_VERSION) SQLC_BIN='$(abspath $(SQLC_BIN))' ./scripts/verify-generated.sh
+
+# A versioned binary under TOOLS_BIN lets CI cache sqlc instead of rebuilding it.
+$(SQLC_BIN):
+ mkdir -p $(TOOLS_BIN)
+ gobin=$$(mktemp -d '$(abspath $(TOOLS_BIN))/install.XXXXXX') && \
+ GOTOOLCHAIN=$(GO_TOOLCHAIN_VERSION) GOBIN="$$gobin" go install github.com/sqlc-dev/sqlc/cmd/sqlc@$(SQLC_VERSION) && \
+ mv "$$gobin/sqlc" $@ && rmdir "$$gobin"
fmt:
gofmt -w cmd internal tests ../../skills