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: compute each Go check's cache key once

shoudi zheng8d8a1d474585
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
index 21511ad1..09caec08 100644
--- a/.github/actions/setup/action.yml
+++ b/.github/actions/setup/action.yml
@@ -1,5 +1,5 @@
name: Set up the toolchain
-description: Node, pnpm and Go at the repository's pinned versions, with workspace dependencies installed, and a BASE that shares history with HEAD.
+description: Go at the repository's pinned version and a BASE that shares history with HEAD; the node and install inputs control the pinned Node, pnpm and the workspace install.
inputs:
node:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 56a846a8..67f960f0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -181,16 +181,29 @@ jobs:
# main's latest entry; only pushes to main save. Go trims build cache
# entries unused for five days, so the restored cache does not grow
# without bound.
+ - id: gocache
+ if: needs.changes.outputs[matrix.app] == 'true'
+ shell: bash
+ env:
+ APP: ${{ matrix.app }}
+ GO_SUM_HASH: ${{ hashFiles('apps/teamhub/go.sum', 'apps/computer/local-daemon/go.sum', 'contracts/generated/go/go.sum') }}
+ run: |
+ case "$APP" in
+ teamhub | computer-go | desktop | contracts) echo "is_go=true" ;;
+ *) echo "is_go=false" ;;
+ esac >>"$GITHUB_OUTPUT"
+ echo "app_prefix=go-$APP-$RUNNER_OS-" >>"$GITHUB_OUTPUT"
+ echo "prefix=go-$APP-$RUNNER_OS-$GO_SUM_HASH-" >>"$GITHUB_OUTPUT"
- uses: actions/cache/restore@v4
- if: contains(fromJSON('["teamhub","computer-go","desktop","contracts"]'), matrix.app) && needs.changes.outputs[matrix.app] == 'true'
+ if: steps.gocache.outputs.is_go == 'true'
with:
path: |
~/.cache/go-build
~/go/pkg/mod
- key: go-${{ matrix.app }}-${{ runner.os }}-${{ hashFiles('apps/teamhub/go.sum', 'apps/computer/local-daemon/go.sum', 'contracts/generated/go/go.sum') }}-${{ github.sha }}
+ key: ${{ steps.gocache.outputs.prefix }}${{ github.sha }}
restore-keys: |
- go-${{ matrix.app }}-${{ runner.os }}-${{ hashFiles('apps/teamhub/go.sum', 'apps/computer/local-daemon/go.sum', 'contracts/generated/go/go.sum') }}-
- go-${{ matrix.app }}-${{ runner.os }}-
+ ${{ steps.gocache.outputs.prefix }}
+ ${{ steps.gocache.outputs.app_prefix }}
# 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.
@@ -216,9 +229,9 @@ jobs:
path: ~/.cache/golangci-lint
key: golangci-lint-${{ runner.os }}-${{ hashFiles('apps/teamhub/go.sum', '.golangci.yml') }}-${{ github.sha }}
- uses: actions/cache/save@v4
- if: always() && github.event_name == 'push' && contains(fromJSON('["teamhub","computer-go","desktop","contracts"]'), matrix.app) && needs.changes.outputs[matrix.app] == 'true'
+ if: always() && github.event_name == 'push' && steps.gocache.outputs.is_go == 'true'
with:
path: |
~/.cache/go-build
~/go/pkg/mod
- key: go-${{ matrix.app }}-${{ runner.os }}-${{ hashFiles('apps/teamhub/go.sum', 'apps/computer/local-daemon/go.sum', 'contracts/generated/go/go.sum') }}-${{ github.sha }}
+ key: ${{ steps.gocache.outputs.prefix }}${{ github.sha }}