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: start an app's check job only when its paths change
shoudi zhengf4b2524c7752
diff --git a/.github/actions/check/action.yml b/.github/actions/check/action.ymlnew file mode 100644index 00000000..873829af--- /dev/null+++ b/.github/actions/check/action.yml@@ -0,0 +1,91 @@+name: Check app+description: Set up the toolchain and caches for one app and run its fast check.++inputs:+ app:+ description: The app whose `make check-<app>` target runs.+ required: true++runs:+ using: composite+ steps:+ # teamhub runs only Go. computer-go's tests run the managed-tools scripts,+ # which need the pinned Node but no workspace packages.+ # 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+ # entries unused for five days, so the restored cache does not grow+ # without bound.+ - id: plan+ shell: bash+ env:+ APP: ${{ inputs.app }}+ GO_SUM_HASH: ${{ hashFiles('apps/teamhub/go.sum', 'apps/computer/local-daemon/go.sum', 'contracts/generated/go/go.sum') }}+ run: |+ set -euo pipefail+ case "$APP" in+ teamhub) is_go=true node=false install=false ;;+ computer-go) is_go=true node=true install=false ;;+ desktop | contracts) is_go=true node=true install=true ;;+ packages | teamhub-cli | installer) is_go=false node=true install=true ;;+ *)+ echo "::error::Unknown app: $APP"+ exit 1+ ;;+ esac+ {+ echo "is_go=$is_go"+ echo "node=$node"+ echo "install=$install"+ echo "app_prefix=go-$APP-$RUNNER_OS-"+ echo "prefix=go-$APP-$RUNNER_OS-$GO_SUM_HASH-"+ } >>"$GITHUB_OUTPUT"+ - uses: ./.github/actions/setup+ with:+ node: ${{ steps.plan.outputs.node }}+ install: ${{ steps.plan.outputs.install }}+ go: ${{ steps.plan.outputs.is_go }}+ - uses: actions/cache/restore@v4+ if: steps.plan.outputs.is_go == 'true'+ with:+ path: |+ ~/.cache/go-build+ ~/go/pkg/mod+ key: ${{ steps.plan.outputs.prefix }}${{ github.sha }}+ restore-keys: |+ ${{ steps.plan.outputs.prefix }}+ ${{ steps.plan.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.+ - uses: actions/cache@v4+ if: inputs.app == 'teamhub'+ with:+ path: apps/teamhub/.tools/bin+ 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+ if: inputs.app == 'teamhub'+ 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') }}-+ # BASE comes from the workflow env.+ - shell: bash+ env:+ APP: ${{ inputs.app }}+ run: make "check-$APP" BASE="$BASE"+ - uses: actions/cache/save@v4+ if: always() && github.event_name == 'push' && inputs.app == 'teamhub'+ with:+ 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' && steps.plan.outputs.is_go == 'true'+ with:+ path: |+ ~/.cache/go-build+ ~/go/pkg/mod+ key: ${{ steps.plan.outputs.prefix }}${{ github.sha }}diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex a8d6f3fc..342158bd 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -2,7 +2,9 @@ name: CI# The repository gate runs on every pull request and merge-queue build; each# app's fast check runs only when its paths change; the web check is split-# into a static job and sharded test jobs. A merge-queue build+# into a static job and sharded test jobs. An unchanged app's job is skipped,+# which GitHub reports as success for its required check; a failed path+# filter makes every app check fail instead of skipping. A merge-queue build# checks the paths its whole group changes, on top of the latest main. Pushes# to main run every check. CI runs the# computer daemon's Go unit tests; the rest of check-computer (TS and process@@ -122,7 +124,7 @@ jobs:web:name: check (web)needs: [changes, web-static, web-tests]- if: always()+ if: ${{ !cancelled() }}runs-on: ubuntu-lateststeps:- shell: bash@@ -151,94 +153,128 @@ jobs:doneexit "$status"- check:+ packages:+ name: check (packages)needs: changes+ if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.packages == 'true') }}runs-on: ubuntu-latest- strategy:- fail-fast: false- matrix:- app:- [- packages,- teamhub-cli,- installer,- desktop,- contracts,- teamhub,- computer-go,- ]steps:- - name: Skip unchanged app- if: needs.changes.outputs[matrix.app] != 'true'- run: echo "No ${{ matrix.app }} paths changed."+ - name: Fail when the path filter failed+ if: needs.changes.result != 'success'+ run: |+ echo "::error::The changes job did not succeed (${{ needs.changes.result }}); no check can be skipped."+ exit 1- uses: actions/checkout@v4- if: needs.changes.outputs[matrix.app] == 'true'with:fetch-depth: 0- # 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- # 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') }}+ - uses: ./.github/actions/check+ with:+ app: packages++ teamhub_cli:+ name: check (teamhub-cli)+ needs: changes+ if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs['teamhub-cli'] == 'true') }}+ runs-on: ubuntu-latest+ steps:+ - name: Fail when the path filter failed+ if: needs.changes.result != 'success'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: ./.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:- path: |- ~/.cache/go-build- ~/go/pkg/mod- key: ${{ steps.gocache.outputs.prefix }}${{ github.sha }}- restore-keys: |- ${{ 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.- - 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/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 }}- - uses: actions/cache/save@v4- if: always() && github.event_name == 'push' && steps.gocache.outputs.is_go == 'true'- with:- path: |- ~/.cache/go-build- ~/go/pkg/mod- key: ${{ steps.gocache.outputs.prefix }}${{ github.sha }}+ echo "::error::The changes job did not succeed (${{ needs.changes.result }}); no check can be skipped."+ exit 1+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0+ - uses: ./.github/actions/check+ with:+ app: teamhub-cli++ installer:+ name: check (installer)+ needs: changes+ if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.installer == 'true') }}+ runs-on: ubuntu-latest+ steps:+ - name: Fail when the path filter failed+ if: needs.changes.result != 'success'+ run: |+ echo "::error::The changes job did not succeed (${{ needs.changes.result }}); no check can be skipped."+ exit 1+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0+ - uses: ./.github/actions/check+ with:+ app: installer++ desktop:+ name: check (desktop)+ needs: changes+ if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.desktop == 'true') }}+ runs-on: ubuntu-latest+ steps:+ - name: Fail when the path filter failed+ if: needs.changes.result != 'success'+ run: |+ echo "::error::The changes job did not succeed (${{ needs.changes.result }}); no check can be skipped."+ exit 1+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0+ - uses: ./.github/actions/check+ with:+ app: desktop++ contracts:+ name: check (contracts)+ needs: changes+ if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.contracts == 'true') }}+ runs-on: ubuntu-latest+ steps:+ - name: Fail when the path filter failed+ if: needs.changes.result != 'success'+ run: |+ echo "::error::The changes job did not succeed (${{ needs.changes.result }}); no check can be skipped."+ exit 1+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0+ - uses: ./.github/actions/check+ with:+ app: contracts++ teamhub:+ name: check (teamhub)+ needs: changes+ if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.teamhub == 'true') }}+ runs-on: ubuntu-latest+ steps:+ - name: Fail when the path filter failed+ if: needs.changes.result != 'success'+ run: |+ echo "::error::The changes job did not succeed (${{ needs.changes.result }}); no check can be skipped."+ exit 1+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0+ - uses: ./.github/actions/check+ with:+ app: teamhub++ computer_go:+ name: check (computer-go)+ needs: changes+ if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs['computer-go'] == 'true') }}+ runs-on: ubuntu-latest+ steps:+ - name: Fail when the path filter failed+ if: needs.changes.result != 'success'+ run: |+ echo "::error::The changes job did not succeed (${{ needs.changes.result }}); no check can be skipped."+ exit 1+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0+ - uses: ./.github/actions/check+ with:+ app: computer-go