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: restore pinned Node and Go from the cache and skip Go where unused

shoudi zheng0a17545072f8
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
index 09caec08..f93f82ed 100644
--- a/.github/actions/setup/action.yml
+++ b/.github/actions/setup/action.yml
@@ -8,6 +8,9 @@ inputs:
install:
description: Set up pnpm and install workspace dependencies; needs node. Checks that only run Node scripts with builtin modules pass false.
default: "true"
+ go:
+ description: Set up Go. Checks that build or run no Go pass false.
+ default: "true"
runs:
using: composite
@@ -22,6 +25,25 @@ runs:
echo "::notice::BASE $BASE shares no history with HEAD; the changed-file checks compare HEAD with itself."
echo "BASE=$(git rev-parse HEAD)" >>"$GITHUB_ENV"
fi
+ # The runner image ships neither pinned version, and setup-node and
+ # setup-go spend about 8 s and 15 s copying a download into the tool cache.
+ # Restoring that tool cache directory takes a few seconds. The entries hold
+ # only the pinned release, so their keys are the versions.
+ - id: versions
+ shell: bash
+ run: |
+ echo "node=$(tr -d '[:space:]' <.node-version)" >>"$GITHUB_OUTPUT"
+ echo "go=$(sed -n 's/^go //p' apps/teamhub/go.mod)" >>"$GITHUB_OUTPUT"
+ - uses: actions/cache@v4
+ if: inputs.node == 'true'
+ with:
+ path: ${{ runner.tool_cache }}/node/${{ steps.versions.outputs.node }}
+ key: toolcache-node-${{ runner.os }}-${{ runner.arch }}-${{ steps.versions.outputs.node }}
+ - uses: actions/cache@v4
+ if: inputs.go == 'true'
+ with:
+ path: ${{ runner.tool_cache }}/go/${{ steps.versions.outputs.go }}
+ key: toolcache-go-${{ runner.os }}-${{ runner.arch }}-${{ steps.versions.outputs.go }}
# Reads the version from packageManager in package.json.
- uses: pnpm/action-setup@v4
if: inputs.install == 'true'
@@ -34,6 +56,7 @@ runs:
# whichever job finishes first, often one that compiled no Go, and its key
# never changes while go.sum stays the same.
- uses: actions/setup-go@v5
+ if: inputs.go == 'true'
with:
go-version-file: apps/teamhub/go.mod
cache: false
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 67f960f0..a8d6f3fc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -81,6 +81,8 @@ jobs:
with:
fetch-depth: 0
- uses: ./.github/actions/setup
+ with:
+ go: false
- run: make check-repository-gate BASE="$BASE"
web-static:
@@ -92,6 +94,8 @@ jobs:
with:
fetch-depth: 0
- uses: ./.github/actions/setup
+ with:
+ go: false
- run: make check-web-static BASE="$BASE"
web-tests:
@@ -108,6 +112,8 @@ jobs:
with:
fetch-depth: 0
- uses: ./.github/actions/setup
+ with:
+ go: false
- run: make check-web-tests SHARD=${{ matrix.shard }}/3
# Reports the required `check (web)` context from the split web jobs. When
@@ -169,13 +175,6 @@ jobs:
if: needs.changes.outputs[matrix.app] == 'true'
with:
fetch-depth: 0
- - uses: ./.github/actions/setup
- if: needs.changes.outputs[matrix.app] == 'true'
- # teamhub runs only Go. computer-go's tests run the managed-tools
- # scripts, which need the pinned Node but no workspace packages.
- with:
- node: ${{ matrix.app != 'teamhub' }}
- install: ${{ matrix.app != 'teamhub' && matrix.app != 'computer-go' }}
# Each Go check keeps its own build and module cache, so one job's save
# never replaces another's. Pull requests and merge-queue builds restore
# main's latest entry; only pushes to main save. Go trims build cache
@@ -194,6 +193,14 @@ jobs:
esac >>"$GITHUB_OUTPUT"
echo "app_prefix=go-$APP-$RUNNER_OS-" >>"$GITHUB_OUTPUT"
echo "prefix=go-$APP-$RUNNER_OS-$GO_SUM_HASH-" >>"$GITHUB_OUTPUT"
+ - uses: ./.github/actions/setup
+ if: needs.changes.outputs[matrix.app] == 'true'
+ # teamhub runs only Go. computer-go's tests run the managed-tools
+ # scripts, which need the pinned Node but no workspace packages.
+ with:
+ node: ${{ matrix.app != 'teamhub' }}
+ install: ${{ matrix.app != 'teamhub' && matrix.app != 'computer-go' }}
+ go: ${{ steps.gocache.outputs.is_go }}
- uses: actions/cache/restore@v4
if: steps.gocache.outputs.is_go == 'true'
with: