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): build only the default sqlc binary and drop the go run fallback

shoudi zhenge2353313890a
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 25549f10..2dd86844 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -109,7 +109,7 @@ jobs:
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') }}
+ key: teamhub-tools-${{ runner.os }}-${{ hashFiles('apps/teamhub/Makefile', '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
diff --git a/apps/teamhub/Makefile b/apps/teamhub/Makefile
index 31760526..957c2a11 100644
--- a/apps/teamhub/Makefile
+++ b/apps/teamhub/Makefile
@@ -17,22 +17,27 @@ 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)
+SQLC_DEFAULT_BIN := $(TOOLS_BIN)/sqlc-$(SQLC_VERSION)-$(GO_TOOLCHAIN_VERSION)
+SQLC_BIN ?= $(SQLC_DEFAULT_BIN)
+# Only the default versioned binary is built here. An explicit SQLC_BIN, a path
+# or a command on PATH, is used as given.
+SQLC_PREREQ := $(if $(filter $(SQLC_DEFAULT_BIN),$(SQLC_BIN)),$(SQLC_DEFAULT_BIN))
+SQLC_RUN := $(if $(SQLC_PREREQ),$(abspath $(SQLC_BIN)),$(SQLC_BIN))
RELIABILITY_TESTS := Test(RoomEventCatchupAndSSE|SSEClosesWhenSessionExpires|SSEClosesWhenSessionIsRevoked|SSEClosesDuringApplicationShutdown)
install:
pnpm -C ../.. install
-generate: $(SQLC_BIN)
+generate: $(SQLC_PREREQ)
$(MAKE) -C ../.. contracts-generate
- SQLC_VERSION=$(SQLC_VERSION) SQLC_BIN='$(abspath $(SQLC_BIN))' ./scripts/verify-generated.sh --write
+ SQLC_BIN='$(SQLC_RUN)' ./scripts/verify-generated.sh --write
-sqlc-verify: $(SQLC_BIN)
- SQLC_VERSION=$(SQLC_VERSION) SQLC_BIN='$(abspath $(SQLC_BIN))' ./scripts/verify-generated.sh
+sqlc-verify: $(SQLC_PREREQ)
+ SQLC_BIN='$(SQLC_RUN)' ./scripts/verify-generated.sh
# A versioned binary under TOOLS_BIN lets CI cache sqlc instead of rebuilding it.
-$(SQLC_BIN):
+$(SQLC_DEFAULT_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) && \
diff --git a/apps/teamhub/scripts/verify-generated.sh b/apps/teamhub/scripts/verify-generated.sh
index 5648d1d6..c72984cb 100755
--- a/apps/teamhub/scripts/verify-generated.sh
+++ b/apps/teamhub/scripts/verify-generated.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
-: "${SQLC_VERSION:?SQLC_VERSION is required}"
+: "${SQLC_BIN:?SQLC_BIN is required; run this through make generate or make sqlc-verify}"
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
tmp_root="$(mktemp -d "${TMPDIR:-/tmp}/teamhub-generated.XXXXXX")"
@@ -14,11 +14,7 @@ cp -R "$repo_root/internal/store/queries" "$tmp_root/internal/store/queries"
(
cd "$tmp_root"
- if [[ -n "${SQLC_BIN:-}" ]]; then
- "$SQLC_BIN" generate
- else
- go run "github.com/sqlc-dev/sqlc/cmd/sqlc@${SQLC_VERSION}" generate
- fi
+ "$SQLC_BIN" generate
)
if [[ ${1:-} == --write ]]; then