Files
tailscale/.github/actions/go-cache/action.yml
T
Brad Fitzpatrick a54bdf2bf2 .github/actions/go-cache: cache the cigocacher binary
Building cigocacher took most of the ~15-27s "Set up cigocacher" step
on every Windows job. Cache the binary in actions/cache, keyed on
cmd/cigocacher, go.mod, and go.sum, and add a test that cigocacher has
no other tailscale.com dependencies so that key stays complete.

Updates tailscale/corp#34812
Updates tailscale/corp#28679

Change-Id: I2def6f28a045249b2e87331a1f42c621e161031f
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-11-22 07:02:10 -08:00

53 lines
1.7 KiB
YAML

name: go-cache
description: Set up build to use cigocacher
inputs:
cigocached-url:
description: URL of the cigocached server
required: true
cigocached-host:
description: Host to dial for the cigocached server
required: true
checkout-path:
description: Path to cloned repository
required: true
cache-dir:
description: Directory to use for caching
required: true
outputs:
success:
description: Whether cigocacher was set up successfully
value: ${{ steps.setup.outputs.success }}
runs:
using: composite
steps:
# cigocacher has no tailscale.com dependencies outside cmd/cigocacher
# (see TestDeps), so its binary depends only on these files.
- name: Compute cigocacher cache key
id: key
if: inputs.cigocached-url != ''
shell: bash
working-directory: ${{ inputs.checkout-path }}
run: echo "key=cigocacher-$RUNNER_OS-$RUNNER_ARCH-$(cat cmd/cigocacher/*.go go.mod go.sum | sha256sum | cut -c1-32)" >> "$GITHUB_OUTPUT"
- name: Restore cigocacher binary
if: inputs.cigocached-url != ''
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # zizmor: ignore[cache-poisoning] v5.0.4
with:
path: ${{ runner.temp }}/cigocacher-bin
key: ${{ steps.key.outputs.key }}
- name: Setup cigocacher
id: setup
shell: bash
env:
URL: ${{ inputs.cigocached-url }}
HOST: ${{ inputs.cigocached-host }}
CACHE_DIR: ${{ inputs.cache-dir }}
BIN_DIR: ${{ runner.temp }}/cigocacher-bin
working-directory: ${{ inputs.checkout-path }}
# https://github.com/orgs/community/discussions/25910
run: $GITHUB_ACTION_PATH/action.sh