@ -19,7 +19,6 @@ env:
# toplevel directories "src" (for the checked out source code), and "gomodcache"
# and other caches as siblings to follow.
GOMODCACHE : ${{ github.workspace }}/gomodcache
CMD_GO_USE_GIT_HASH : "true"
on :
push:
@ -49,7 +48,7 @@ jobs:
cache-key : ${{ steps.hash.outputs.key }}
steps:
- name : Checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Compute cache key from go.{mod,sum}
@ -89,7 +88,7 @@ jobs:
- shard : '4/4'
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache
@ -127,7 +126,7 @@ jobs:
needs : gomod-cache
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache
@ -137,20 +136,21 @@ jobs:
key : ${{ needs.gomod-cache.outputs.cache-key }}
enableCrossOsArchive : true
- name : Restore Cache
id : restore-cache
uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
uses : actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
# Note: this is only restoring the build cache. Mod cache is shared amongst
# all jobs in the workflow.
# Note: unlike the other setups, this is only grabbing the mod download
# cache, rather than the whole mod directory, as the download cache
# contains zips that can be unpacked in parallel faster than they can be
# fetched and extracted by tar
path : |
~/.cache/go-build
~\AppData\Local\go-build
key : ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }}
# The -2- here should be incremented when the scheme of data to be
# cached changes (e.g. path above changes).
key : ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-2-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
restore-keys : |
${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('**/go.sum') }}-${{ github.job }}-
${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('**/go.sum') }}-
${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-
${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-
${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-2-${{ hashFiles('**/go.sum') }}
${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-2-
- name : build all
if : matrix.buildflags == '' # skip on race builder
working-directory : src
@ -206,26 +206,12 @@ jobs:
shell : bash
run : |
find $(go env GOCACHE) -type f -mmin +90 -delete
- name : Save Cache
# Save cache even on failure, but only on cache miss and main branch to avoid thrashing.
if : always() && steps.restore-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main'
uses : actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
# Note: this is only saving the build cache. Mod cache is shared amongst
# all jobs in the workflow.
path : |
~/.cache/go-build
~\AppData\Local\go-build
key : ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }}
windows:
permissions:
id-token : write # This is required for requesting the GitHub action identity JWT that can auth to cigocached
contents : read # This is required for actions/checkout
# ci-windows-github-1 is a 2022 GitHub-managed runner in our org with 8 cores
# and 32 GB of RAM. It is connected to a private Azure VNet that hosts cigocached.
# https://github.com/organizations/tailscale/settings/actions/github-hosted-runners/5
runs-on : ci-windows-github-1
# windows-8vpu is a 2022 GitHub-managed runner in our
# org with 8 cores and 32 GB of RAM:
# https://github.com/organizations/tailscale/settings/actions/github-hosted-runners/1
runs-on : windows-8vcpu
needs : gomod-cache
name : Windows (${{ matrix.name || matrix.shard}})
strategy:
@ -234,40 +220,54 @@ jobs:
include:
- key : "win-bench"
name : "benchmarks"
- key : "win-tool-go"
name : "./tool/go"
- key : "win-shard-1-2"
shard : "1/2"
- key : "win-shard-2-2"
shard : "2/2"
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : ${{ github.workspace }}/ src
path : src
- name : Install Go
if : matrix.key != 'win-tool-go'
uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file : ${{ github.workspace }}/ src/go.mod
go-version-file : src/go.mod
cache : false
- name : Restore Go module cache
if : matrix.key != 'win-tool-go'
uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path : gomodcache
key : ${{ needs.gomod-cache.outputs.cache-key }}
enableCrossOsArchive : true
- name : Set up cigocacher
i d: cigocacher-setup
uses : ./src/.github/ actions/go- cache
- name : Restore Cache
i f: matrix.key != 'win-tool-go'
uses : actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
checkout-path : ${{ github.workspace }}/src
cache-dir : ${{ github.workspace }}/cigocacher
cigocached-url : ${{ vars.CIGOCACHED_AZURE_URL }}
cigocached-host : ${{ vars.CIGOCACHED_AZURE_HOST }}
path : |
~/.cache/go-build
~\AppData\Local\go-build
# The -2- here should be incremented when the scheme of data to be
# cached changes (e.g. path above changes).
key : ${{ github.job }}-${{ matrix.key }}-go-2-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
restore-keys : |
${{ github.job }}-${{ matrix.key }}-go-2-${{ hashFiles('**/go.sum') }}
${{ github.job }}-${{ matrix.key }}-go-2-
- name : test-tool-go
if : matrix.key == 'win-tool-go'
working-directory : src
run : ./tool/go version
- name : test
if : matrix.key != 'win-bench' # skip on bench builder
if : matrix.key != 'win-bench' && matrix.key != 'win-tool-go' # skip on bench builder
working-directory : src
run : go run ./cmd/testwrapper sharded:${{ matrix.shard }}
@ -279,26 +279,12 @@ jobs:
# the equals signs cause great confusion.
run : go test ./... -bench . -benchtime 1x -run "^$"
- name : Print stats
shell : pwsh
if : steps.cigocacher-setup.outputs.success == 'true'
env:
GOCACHEPROG : ${{ env.GOCACHEPROG }}
run : |
Invoke-Expression "$env:GOCACHEPROG --stats" | jq .
win-tool-go:
runs-on : windows-latest
needs : gomod-cache
name : Windows (win-tool-go)
steps:
- name : checkout
uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path : src
- name : test-tool-go
- name : Tidy cache
if : matrix.key != 'win-tool-go'
working-directory : src
run : ./tool/go version
shell : bash
run : |
find $(go env GOCACHE) -type f -mmin +90 -delete
privileged:
needs : gomod-cache
@ -308,7 +294,7 @@ jobs:
options : --privileged
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache
@ -331,7 +317,7 @@ jobs:
if : github.repository == 'tailscale/tailscale'
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache
@ -387,29 +373,31 @@ jobs:
runs-on : ubuntu-24.04
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache
uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path : gomodcache
key : ${{ needs.gomod-cache.outputs.cache-key }}
enableCrossOsArchive : true
- name : Restore Cache
id : restore-cache
uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
uses : actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
# Note: this is only restoring the build cache. Mod cache is shared amongst
# all jobs in the workflow.
# Note: unlike the other setups, this is only grabbing the mod download
# cache, rather than the whole mod directory, as the download cache
# contains zips that can be unpacked in parallel faster than they can be
# fetched and extracted by tar
path : |
~/.cache/go-build
~\AppData\Local\go-build
key : ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }}
# The -2- here should be incremented when the scheme of data to be
# cached changes (e.g. path above changes).
key : ${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
restore-keys : |
${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-
${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('**/go.sum') }}-
${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-
- name : Restore Go module cache
uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path : gomodcache
key : ${{ needs.gomod-cache.outputs.cache-key }}
enableCrossOsArchive : true
- name : build all
working-directory : src
run : ./tool/go build ./cmd/...
@ -430,17 +418,6 @@ jobs:
shell : bash
run : |
find $(go env GOCACHE) -type f -mmin +90 -delete
- name : Save Cache
# Save cache even on failure, but only on cache miss and main branch to avoid thrashing.
if : always() && steps.restore-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main'
uses : actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
# Note: this is only saving the build cache. Mod cache is shared amongst
# all jobs in the workflow.
path : |
~/.cache/go-build
~\AppData\Local\go-build
key : ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }}
ios : # similar to cross above, but iOS can't build most of the repo. So, just
# make it build a few smoke packages.
@ -448,7 +425,7 @@ jobs:
needs : gomod-cache
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache
@ -486,29 +463,31 @@ jobs:
runs-on : ubuntu-24.04
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache
uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path : gomodcache
key : ${{ needs.gomod-cache.outputs.cache-key }}
enableCrossOsArchive : true
- name : Restore Cache
id : restore-cache
uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
uses : actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
# Note: this is only restoring the build cache. Mod cache is shared amongst
# all jobs in the workflow.
# Note: unlike the other setups, this is only grabbing the mod download
# cache, rather than the whole mod directory, as the download cache
# contains zips that can be unpacked in parallel faster than they can be
# fetched and extracted by tar
path : |
~/.cache/go-build
~\AppData\Local\go-build
key : ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }}
# The -2- here should be incremented when the scheme of data to be
# cached changes (e.g. path above changes).
key : ${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
restore-keys : |
${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-
${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('**/go.sum') }}-
${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-
- name : Restore Go module cache
uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path : gomodcache
key : ${{ needs.gomod-cache.outputs.cache-key }}
enableCrossOsArchive : true
- name : build core
working-directory : src
run : ./tool/go build ./cmd/tailscale ./cmd/tailscaled
@ -522,17 +501,6 @@ jobs:
shell : bash
run : |
find $(go env GOCACHE) -type f -mmin +90 -delete
- name : Save Cache
# Save cache even on failure, but only on cache miss and main branch to avoid thrashing.
if : always() && steps.restore-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main'
uses : actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
# Note: this is only saving the build cache. Mod cache is shared amongst
# all jobs in the workflow.
path : |
~/.cache/go-build
~\AppData\Local\go-build
key : ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }}
android:
# similar to cross above, but android fails to build a few pieces of the
@ -542,7 +510,7 @@ jobs:
needs : gomod-cache
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
# Super minimal Android build that doesn't even use CGO and doesn't build everything that's needed
@ -567,29 +535,31 @@ jobs:
needs : gomod-cache
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache
uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path : gomodcache
key : ${{ needs.gomod-cache.outputs.cache-key }}
enableCrossOsArchive : true
- name : Restore Cache
id : restore-cache
uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
uses : actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
# Note: this is only restoring the build cache. Mod cache is shared amongst
# all jobs in the workflow.
# Note: unlike the other setups, this is only grabbing the mod download
# cache, rather than the whole mod directory, as the download cache
# contains zips that can be unpacked in parallel faster than they can be
# fetched and extracted by tar
path : |
~/.cache/go-build
~\AppData\Local\go-build
key : ${{ runner.os }}-js-wasm-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }}
# The -2- here should be incremented when the scheme of data to be
# cached changes (e.g. path above changes).
key : ${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
restore-keys : |
${{ runner.os }}-js-wasm-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-
${{ runner.os }}-js-wasm-go-${{ hashFiles('**/go.sum') }}-
${{ runner.os }}-js-wasm-go-
${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}
${{ github.job }}-${{ runner.os }}-go-2-
- name : Restore Go module cache
uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path : gomodcache
key : ${{ needs.gomod-cache.outputs.cache-key }}
enableCrossOsArchive : true
- name : build tsconnect client
working-directory : src
run : ./tool/go build ./cmd/tsconnect/wasm ./cmd/tailscale/cli
@ -608,24 +578,13 @@ jobs:
shell : bash
run : |
find $(go env GOCACHE) -type f -mmin +90 -delete
- name : Save Cache
# Save cache even on failure, but only on cache miss and main branch to avoid thrashing.
if : always() && steps.restore-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main'
uses : actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
# Note: this is only saving the build cache. Mod cache is shared amongst
# all jobs in the workflow.
path : |
~/.cache/go-build
~\AppData\Local\go-build
key : ${{ runner.os }}-js-wasm-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }}
tailscale_go : # Subset of tests that depend on our custom Go toolchain.
runs-on : ubuntu-24.04
needs : gomod-cache
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name : Set GOMODCACHE env
run : echo "GOMODCACHE=$HOME/.cache/go-mod" >> $GITHUB_ENV
- name : Restore Go module cache
@ -710,7 +669,7 @@ jobs:
needs : gomod-cache
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Set GOMODCACHE env
@ -730,7 +689,7 @@ jobs:
needs : gomod-cache
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache
@ -754,7 +713,7 @@ jobs:
needs : gomod-cache
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache
@ -776,7 +735,7 @@ jobs:
needs : gomod-cache
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache
@ -830,7 +789,7 @@ jobs:
steps:
- name : checkout
uses : actions/checkout@ 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses : actions/checkout@ 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path : src
- name : Restore Go module cache