mirror of
https://github.com/tailscale/tailscale.git
synced 2025-06-22 08:08:39 +00:00
.github/workflows: do a go mod download & cache it before all jobs
Updates tailscale/corp#28679 Change-Id: Ib0127cb2b03f781fc3187199abe4881e97074f5f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
8e6f63cf11
commit
5b7cf7fc36
244
.github/workflows/test.yml
vendored
244
.github/workflows/test.yml
vendored
@ -15,6 +15,10 @@ env:
|
|||||||
# - false: we expect fuzzing to be happy, and should report failure if it's not.
|
# - false: we expect fuzzing to be happy, and should report failure if it's not.
|
||||||
# - true: we expect fuzzing is broken, and should report failure if it start working.
|
# - true: we expect fuzzing is broken, and should report failure if it start working.
|
||||||
TS_FUZZ_CURRENTLY_BROKEN: false
|
TS_FUZZ_CURRENTLY_BROKEN: false
|
||||||
|
# GOMODCACHE is the same definition on all OSes. Within the workspace, we use
|
||||||
|
# toplevel directories "src" (for the checked out source code), and "gomodcache"
|
||||||
|
# and other caches as siblings to follow.
|
||||||
|
GOMODCACHE: ${{ github.workspace }}/gomodcache
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -38,8 +42,42 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
gomod-cache:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
outputs:
|
||||||
|
cache-key: ${{ steps.hash.outputs.key }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
- name: Compute cache key from go.{mod,sum}
|
||||||
|
id: hash
|
||||||
|
run: echo "key=gomod-cross3-${{ hashFiles('src/go.mod', 'src/go.sum') }}" >> $GITHUB_OUTPUT
|
||||||
|
# See if the cache entry already exists to avoid downloading it
|
||||||
|
# and doing the cache write again.
|
||||||
|
- id: check-cache
|
||||||
|
uses: actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
path: gomodcache # relative to workspace; see env note at top of file
|
||||||
|
key: ${{ steps.hash.outputs.key }}
|
||||||
|
lookup-only: true
|
||||||
|
enableCrossOsArchive: true
|
||||||
|
- name: Download modules
|
||||||
|
if: steps.check-cache.outputs.cache-hit != 'true'
|
||||||
|
working-directory: src
|
||||||
|
run: go mod download
|
||||||
|
- name: Cache Go modules
|
||||||
|
if: steps.check-cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache # relative to workspace; see env note at top of file
|
||||||
|
key: ${{ steps.hash.outputs.key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
|
|
||||||
race-root-integration:
|
race-root-integration:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
needs: gomod-cache
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false # don't abort the entire matrix if one element fails
|
fail-fast: false # don't abort the entire matrix if one element fails
|
||||||
matrix:
|
matrix:
|
||||||
@ -51,9 +89,19 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: build test wrapper
|
- name: build test wrapper
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go build -o /tmp/testwrapper ./cmd/testwrapper
|
run: ./tool/go build -o /tmp/testwrapper ./cmd/testwrapper
|
||||||
- name: integration tests as root
|
- name: integration tests as root
|
||||||
|
working-directory: src
|
||||||
run: PATH=$PWD/tool:$PATH /tmp/testwrapper -exec "sudo -E" -race ./tstest/integration/
|
run: PATH=$PWD/tool:$PATH /tmp/testwrapper -exec "sudo -E" -race ./tstest/integration/
|
||||||
env:
|
env:
|
||||||
TS_TEST_SHARD: ${{ matrix.shard }}
|
TS_TEST_SHARD: ${{ matrix.shard }}
|
||||||
@ -75,9 +123,18 @@ jobs:
|
|||||||
shard: '3/3'
|
shard: '3/3'
|
||||||
- goarch: "386" # thanks yaml
|
- goarch: "386" # thanks yaml
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
needs: gomod-cache
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: Restore Cache
|
- name: Restore Cache
|
||||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
with:
|
with:
|
||||||
@ -87,7 +144,6 @@ jobs:
|
|||||||
# fetched and extracted by tar
|
# fetched and extracted by tar
|
||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/go/pkg/mod/cache
|
|
||||||
~\AppData\Local\go-build
|
~\AppData\Local\go-build
|
||||||
# The -2- here should be incremented when the scheme of data to be
|
# The -2- here should be incremented when the scheme of data to be
|
||||||
# cached changes (e.g. path above changes).
|
# cached changes (e.g. path above changes).
|
||||||
@ -97,11 +153,13 @@ jobs:
|
|||||||
${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-2-
|
${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-2-
|
||||||
- name: build all
|
- name: build all
|
||||||
if: matrix.buildflags == '' # skip on race builder
|
if: matrix.buildflags == '' # skip on race builder
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go build ${{matrix.buildflags}} ./...
|
run: ./tool/go build ${{matrix.buildflags}} ./...
|
||||||
env:
|
env:
|
||||||
GOARCH: ${{ matrix.goarch }}
|
GOARCH: ${{ matrix.goarch }}
|
||||||
- name: build variant CLIs
|
- name: build variant CLIs
|
||||||
if: matrix.buildflags == '' # skip on race builder
|
if: matrix.buildflags == '' # skip on race builder
|
||||||
|
working-directory: src
|
||||||
run: |
|
run: |
|
||||||
export TS_USE_TOOLCHAIN=1
|
export TS_USE_TOOLCHAIN=1
|
||||||
./build_dist.sh --extra-small ./cmd/tailscaled
|
./build_dist.sh --extra-small ./cmd/tailscaled
|
||||||
@ -116,19 +174,24 @@ jobs:
|
|||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
sudo apt-get -y install qemu-user
|
sudo apt-get -y install qemu-user
|
||||||
- name: build test wrapper
|
- name: build test wrapper
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go build -o /tmp/testwrapper ./cmd/testwrapper
|
run: ./tool/go build -o /tmp/testwrapper ./cmd/testwrapper
|
||||||
- name: test all
|
- name: test all
|
||||||
|
working-directory: src
|
||||||
run: NOBASHDEBUG=true PATH=$PWD/tool:$PATH /tmp/testwrapper ./... ${{matrix.buildflags}}
|
run: NOBASHDEBUG=true PATH=$PWD/tool:$PATH /tmp/testwrapper ./... ${{matrix.buildflags}}
|
||||||
env:
|
env:
|
||||||
GOARCH: ${{ matrix.goarch }}
|
GOARCH: ${{ matrix.goarch }}
|
||||||
TS_TEST_SHARD: ${{ matrix.shard }}
|
TS_TEST_SHARD: ${{ matrix.shard }}
|
||||||
- name: bench all
|
- name: bench all
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go test ${{matrix.buildflags}} -bench=. -benchtime=1x -run=^$ $(for x in $(git grep -l "^func Benchmark" | xargs dirname | sort | uniq); do echo "./$x"; done)
|
run: ./tool/go test ${{matrix.buildflags}} -bench=. -benchtime=1x -run=^$ $(for x in $(git grep -l "^func Benchmark" | xargs dirname | sort | uniq); do echo "./$x"; done)
|
||||||
env:
|
env:
|
||||||
GOARCH: ${{ matrix.goarch }}
|
GOARCH: ${{ matrix.goarch }}
|
||||||
- name: check that no tracked files changed
|
- name: check that no tracked files changed
|
||||||
|
working-directory: src
|
||||||
run: git diff --no-ext-diff --name-only --exit-code || (echo "Build/test modified the files above."; exit 1)
|
run: git diff --no-ext-diff --name-only --exit-code || (echo "Build/test modified the files above."; exit 1)
|
||||||
- name: check that no new files were added
|
- name: check that no new files were added
|
||||||
|
working-directory: src
|
||||||
run: |
|
run: |
|
||||||
# Note: The "error: pathspec..." you see below is normal!
|
# Note: The "error: pathspec..." you see below is normal!
|
||||||
# In the success case in which there are no new untracked files,
|
# In the success case in which there are no new untracked files,
|
||||||
@ -140,22 +203,33 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
- name: Tidy cache
|
- name: Tidy cache
|
||||||
|
working-directory: src
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
find $(go env GOCACHE) -type f -mmin +90 -delete
|
find $(go env GOCACHE) -type f -mmin +90 -delete
|
||||||
find $(go env GOMODCACHE)/cache -type f -mmin +90 -delete
|
|
||||||
windows:
|
windows:
|
||||||
runs-on: windows-2022
|
runs-on: windows-2022
|
||||||
|
needs: gomod-cache
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: src/go.mod
|
||||||
cache: false
|
cache: false
|
||||||
|
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
|
|
||||||
- name: Restore Cache
|
- name: Restore Cache
|
||||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
with:
|
with:
|
||||||
@ -165,7 +239,6 @@ jobs:
|
|||||||
# fetched and extracted by tar
|
# fetched and extracted by tar
|
||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/go/pkg/mod/cache
|
|
||||||
~\AppData\Local\go-build
|
~\AppData\Local\go-build
|
||||||
# The -2- here should be incremented when the scheme of data to be
|
# The -2- here should be incremented when the scheme of data to be
|
||||||
# cached changes (e.g. path above changes).
|
# cached changes (e.g. path above changes).
|
||||||
@ -174,19 +247,22 @@ jobs:
|
|||||||
${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}
|
${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}
|
||||||
${{ github.job }}-${{ runner.os }}-go-2-
|
${{ github.job }}-${{ runner.os }}-go-2-
|
||||||
- name: test
|
- name: test
|
||||||
|
working-directory: src
|
||||||
run: go run ./cmd/testwrapper ./...
|
run: go run ./cmd/testwrapper ./...
|
||||||
- name: bench all
|
- name: bench all
|
||||||
|
working-directory: src
|
||||||
# Don't use -bench=. -benchtime=1x.
|
# Don't use -bench=. -benchtime=1x.
|
||||||
# Somewhere in the layers (powershell?)
|
# Somewhere in the layers (powershell?)
|
||||||
# the equals signs cause great confusion.
|
# the equals signs cause great confusion.
|
||||||
run: go test ./... -bench . -benchtime 1x -run "^$"
|
run: go test ./... -bench . -benchtime 1x -run "^$"
|
||||||
- name: Tidy cache
|
- name: Tidy cache
|
||||||
|
working-directory: src
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
find $(go env GOCACHE) -type f -mmin +90 -delete
|
find $(go env GOCACHE) -type f -mmin +90 -delete
|
||||||
find $(go env GOMODCACHE)/cache -type f -mmin +90 -delete
|
|
||||||
|
|
||||||
privileged:
|
privileged:
|
||||||
|
needs: gomod-cache
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
container:
|
container:
|
||||||
image: golang:latest
|
image: golang:latest
|
||||||
@ -194,36 +270,47 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: chown
|
- name: chown
|
||||||
|
working-directory: src
|
||||||
run: chown -R $(id -u):$(id -g) $PWD
|
run: chown -R $(id -u):$(id -g) $PWD
|
||||||
- name: privileged tests
|
- name: privileged tests
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go test ./util/linuxfw ./derp/xdp
|
run: ./tool/go test ./util/linuxfw ./derp/xdp
|
||||||
|
|
||||||
vm:
|
vm:
|
||||||
|
needs: gomod-cache
|
||||||
runs-on: ["self-hosted", "linux", "vm"]
|
runs-on: ["self-hosted", "linux", "vm"]
|
||||||
# VM tests run with some privileges, don't let them run on 3p PRs.
|
# VM tests run with some privileges, don't let them run on 3p PRs.
|
||||||
if: github.repository == 'tailscale/tailscale'
|
if: github.repository == 'tailscale/tailscale'
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: Run VM tests
|
- name: Run VM tests
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go test ./tstest/integration/vms -v -no-s3 -run-vm-tests -run=TestRunUbuntu2004
|
run: ./tool/go test ./tstest/integration/vms -v -no-s3 -run-vm-tests -run=TestRunUbuntu2004
|
||||||
env:
|
env:
|
||||||
HOME: "/var/lib/ghrunner/home"
|
HOME: "/var/lib/ghrunner/home"
|
||||||
TMPDIR: "/tmp"
|
TMPDIR: "/tmp"
|
||||||
XDG_CACHE_HOME: "/var/lib/ghrunner/cache"
|
XDG_CACHE_HOME: "/var/lib/ghrunner/cache"
|
||||||
|
|
||||||
race-build:
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
steps:
|
|
||||||
- name: checkout
|
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
||||||
- name: build all
|
|
||||||
run: ./tool/go install -race ./cmd/...
|
|
||||||
- name: build tests
|
|
||||||
run: ./tool/go test -race -exec=true ./...
|
|
||||||
|
|
||||||
cross: # cross-compile checks, build only.
|
cross: # cross-compile checks, build only.
|
||||||
|
needs: gomod-cache
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false # don't abort the entire matrix if one element fails
|
fail-fast: false # don't abort the entire matrix if one element fails
|
||||||
matrix:
|
matrix:
|
||||||
@ -262,6 +349,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
- name: Restore Cache
|
- name: Restore Cache
|
||||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
with:
|
with:
|
||||||
@ -271,7 +360,6 @@ jobs:
|
|||||||
# fetched and extracted by tar
|
# fetched and extracted by tar
|
||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/go/pkg/mod/cache
|
|
||||||
~\AppData\Local\go-build
|
~\AppData\Local\go-build
|
||||||
# The -2- here should be incremented when the scheme of data to be
|
# The -2- here should be incremented when the scheme of data to be
|
||||||
# cached changes (e.g. path above changes).
|
# cached changes (e.g. path above changes).
|
||||||
@ -279,7 +367,14 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}
|
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}
|
||||||
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-
|
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: build all
|
- name: build all
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go build ./cmd/...
|
run: ./tool/go build ./cmd/...
|
||||||
env:
|
env:
|
||||||
GOOS: ${{ matrix.goos }}
|
GOOS: ${{ matrix.goos }}
|
||||||
@ -287,30 +382,42 @@ jobs:
|
|||||||
GOARM: ${{ matrix.goarm }}
|
GOARM: ${{ matrix.goarm }}
|
||||||
CGO_ENABLED: "0"
|
CGO_ENABLED: "0"
|
||||||
- name: build tests
|
- name: build tests
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go test -exec=true ./...
|
run: ./tool/go test -exec=true ./...
|
||||||
env:
|
env:
|
||||||
GOOS: ${{ matrix.goos }}
|
GOOS: ${{ matrix.goos }}
|
||||||
GOARCH: ${{ matrix.goarch }}
|
GOARCH: ${{ matrix.goarch }}
|
||||||
CGO_ENABLED: "0"
|
CGO_ENABLED: "0"
|
||||||
- name: Tidy cache
|
- name: Tidy cache
|
||||||
|
working-directory: src
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
find $(go env GOCACHE) -type f -mmin +90 -delete
|
find $(go env GOCACHE) -type f -mmin +90 -delete
|
||||||
find $(go env GOMODCACHE)/cache -type f -mmin +90 -delete
|
|
||||||
|
|
||||||
ios: # similar to cross above, but iOS can't build most of the repo. So, just
|
ios: # similar to cross above, but iOS can't build most of the repo. So, just
|
||||||
# make it build a few smoke packages.
|
# make it build a few smoke packages.
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
needs: gomod-cache
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: build some
|
- name: build some
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go build ./ipn/... ./ssh/tailssh ./wgengine/ ./types/... ./control/controlclient
|
run: ./tool/go build ./ipn/... ./ssh/tailssh ./wgengine/ ./types/... ./control/controlclient
|
||||||
env:
|
env:
|
||||||
GOOS: ios
|
GOOS: ios
|
||||||
GOARCH: arm64
|
GOARCH: arm64
|
||||||
|
|
||||||
crossmin: # cross-compile for platforms where we only check cmd/tailscale{,d}
|
crossmin: # cross-compile for platforms where we only check cmd/tailscale{,d}
|
||||||
|
needs: gomod-cache
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false # don't abort the entire matrix if one element fails
|
fail-fast: false # don't abort the entire matrix if one element fails
|
||||||
matrix:
|
matrix:
|
||||||
@ -332,6 +439,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
- name: Restore Cache
|
- name: Restore Cache
|
||||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
with:
|
with:
|
||||||
@ -341,7 +450,6 @@ jobs:
|
|||||||
# fetched and extracted by tar
|
# fetched and extracted by tar
|
||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/go/pkg/mod/cache
|
|
||||||
~\AppData\Local\go-build
|
~\AppData\Local\go-build
|
||||||
# The -2- here should be incremented when the scheme of data to be
|
# The -2- here should be incremented when the scheme of data to be
|
||||||
# cached changes (e.g. path above changes).
|
# cached changes (e.g. path above changes).
|
||||||
@ -349,7 +457,14 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}
|
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}
|
||||||
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-
|
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: build core
|
- name: build core
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go build ./cmd/tailscale ./cmd/tailscaled
|
run: ./tool/go build ./cmd/tailscale ./cmd/tailscaled
|
||||||
env:
|
env:
|
||||||
GOOS: ${{ matrix.goos }}
|
GOOS: ${{ matrix.goos }}
|
||||||
@ -357,24 +472,34 @@ jobs:
|
|||||||
GOARM: ${{ matrix.goarm }}
|
GOARM: ${{ matrix.goarm }}
|
||||||
CGO_ENABLED: "0"
|
CGO_ENABLED: "0"
|
||||||
- name: Tidy cache
|
- name: Tidy cache
|
||||||
|
working-directory: src
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
find $(go env GOCACHE) -type f -mmin +90 -delete
|
find $(go env GOCACHE) -type f -mmin +90 -delete
|
||||||
find $(go env GOMODCACHE)/cache -type f -mmin +90 -delete
|
|
||||||
|
|
||||||
android:
|
android:
|
||||||
# similar to cross above, but android fails to build a few pieces of the
|
# similar to cross above, but android fails to build a few pieces of the
|
||||||
# repo. We should fix those pieces, they're small, but as a stepping stone,
|
# repo. We should fix those pieces, they're small, but as a stepping stone,
|
||||||
# only test the subset of android that our past smoke test checked.
|
# only test the subset of android that our past smoke test checked.
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
needs: gomod-cache
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
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
|
# Super minimal Android build that doesn't even use CGO and doesn't build everything that's needed
|
||||||
# and is only arm64. But it's a smoke build: it's not meant to catch everything. But it'll catch
|
# and is only arm64. But it's a smoke build: it's not meant to catch everything. But it'll catch
|
||||||
# some Android breakages early.
|
# some Android breakages early.
|
||||||
# TODO(bradfitz): better; see https://github.com/tailscale/tailscale/issues/4482
|
# TODO(bradfitz): better; see https://github.com/tailscale/tailscale/issues/4482
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: build some
|
- name: build some
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go install ./net/netns ./ipn/ipnlocal ./wgengine/magicsock/ ./wgengine/ ./wgengine/router/ ./wgengine/netstack ./util/dnsname/ ./ipn/ ./net/netmon ./wgengine/router/ ./tailcfg/ ./types/logger/ ./net/dns ./hostinfo ./version ./ssh/tailssh
|
run: ./tool/go install ./net/netns ./ipn/ipnlocal ./wgengine/magicsock/ ./wgengine/ ./wgengine/router/ ./wgengine/netstack ./util/dnsname/ ./ipn/ ./net/netmon ./wgengine/router/ ./tailcfg/ ./types/logger/ ./net/dns ./hostinfo ./version ./ssh/tailssh
|
||||||
env:
|
env:
|
||||||
GOOS: android
|
GOOS: android
|
||||||
@ -382,9 +507,12 @@ jobs:
|
|||||||
|
|
||||||
wasm: # builds tsconnect, which is the only wasm build we support
|
wasm: # builds tsconnect, which is the only wasm build we support
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
needs: gomod-cache
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
- name: Restore Cache
|
- name: Restore Cache
|
||||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
with:
|
with:
|
||||||
@ -394,7 +522,6 @@ jobs:
|
|||||||
# fetched and extracted by tar
|
# fetched and extracted by tar
|
||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/go/pkg/mod/cache
|
|
||||||
~\AppData\Local\go-build
|
~\AppData\Local\go-build
|
||||||
# The -2- here should be incremented when the scheme of data to be
|
# The -2- here should be incremented when the scheme of data to be
|
||||||
# cached changes (e.g. path above changes).
|
# cached changes (e.g. path above changes).
|
||||||
@ -402,28 +529,45 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}
|
${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}
|
||||||
${{ github.job }}-${{ runner.os }}-go-2-
|
${{ github.job }}-${{ runner.os }}-go-2-
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: build tsconnect client
|
- name: build tsconnect client
|
||||||
|
working-directory: src
|
||||||
run: ./tool/go build ./cmd/tsconnect/wasm ./cmd/tailscale/cli
|
run: ./tool/go build ./cmd/tsconnect/wasm ./cmd/tailscale/cli
|
||||||
env:
|
env:
|
||||||
GOOS: js
|
GOOS: js
|
||||||
GOARCH: wasm
|
GOARCH: wasm
|
||||||
- name: build tsconnect server
|
- name: build tsconnect server
|
||||||
|
working-directory: src
|
||||||
# Note, no GOOS/GOARCH in env on this build step, we're running a build
|
# Note, no GOOS/GOARCH in env on this build step, we're running a build
|
||||||
# tool that handles the build itself.
|
# tool that handles the build itself.
|
||||||
run: |
|
run: |
|
||||||
./tool/go run ./cmd/tsconnect --fast-compression build
|
./tool/go run ./cmd/tsconnect --fast-compression build
|
||||||
./tool/go run ./cmd/tsconnect --fast-compression build-pkg
|
./tool/go run ./cmd/tsconnect --fast-compression build-pkg
|
||||||
- name: Tidy cache
|
- name: Tidy cache
|
||||||
|
working-directory: src
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
find $(go env GOCACHE) -type f -mmin +90 -delete
|
find $(go env GOCACHE) -type f -mmin +90 -delete
|
||||||
find $(go env GOMODCACHE)/cache -type f -mmin +90 -delete
|
|
||||||
|
|
||||||
tailscale_go: # Subset of tests that depend on our custom Go toolchain.
|
tailscale_go: # Subset of tests that depend on our custom Go toolchain.
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
needs: gomod-cache
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
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
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: test tailscale_go
|
- name: test tailscale_go
|
||||||
run: ./tool/go test -tags=tailscale_go,ts_enable_sockstats ./net/sockstats/...
|
run: ./tool/go test -tags=tailscale_go,ts_enable_sockstats ./net/sockstats/...
|
||||||
|
|
||||||
@ -477,7 +621,7 @@ jobs:
|
|||||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||||
with:
|
with:
|
||||||
oss-fuzz-project-name: 'tailscale'
|
oss-fuzz-project-name: 'tailscale'
|
||||||
fuzz-seconds: 300
|
fuzz-seconds: 150
|
||||||
dry-run: false
|
dry-run: false
|
||||||
language: go
|
language: go
|
||||||
- name: Set artifacts_path in env (workaround for actions/upload-artifact#176)
|
- name: Set artifacts_path in env (workaround for actions/upload-artifact#176)
|
||||||
@ -493,19 +637,40 @@ jobs:
|
|||||||
|
|
||||||
depaware:
|
depaware:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
needs: gomod-cache
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
- name: Set GOMODCACHE env
|
||||||
|
run: echo "GOMODCACHE=$HOME/.cache/go-mod" >> $GITHUB_ENV
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: check depaware
|
- name: check depaware
|
||||||
run: |
|
working-directory: src
|
||||||
make depaware
|
run: make depaware
|
||||||
|
|
||||||
go_generate:
|
go_generate:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
needs: gomod-cache
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: check that 'go generate' is clean
|
- name: check that 'go generate' is clean
|
||||||
|
working-directory: src
|
||||||
run: |
|
run: |
|
||||||
pkgs=$(./tool/go list ./... | grep -Ev 'dnsfallback|k8s-operator|xdp')
|
pkgs=$(./tool/go list ./... | grep -Ev 'dnsfallback|k8s-operator|xdp')
|
||||||
./tool/go generate $pkgs
|
./tool/go generate $pkgs
|
||||||
@ -515,10 +680,20 @@ jobs:
|
|||||||
|
|
||||||
go_mod_tidy:
|
go_mod_tidy:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
needs: gomod-cache
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: check that 'go mod tidy' is clean
|
- name: check that 'go mod tidy' is clean
|
||||||
|
working-directory: src
|
||||||
run: |
|
run: |
|
||||||
./tool/go mod tidy
|
./tool/go mod tidy
|
||||||
echo
|
echo
|
||||||
@ -535,6 +710,7 @@ jobs:
|
|||||||
|
|
||||||
staticcheck:
|
staticcheck:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
needs: gomod-cache
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false # don't abort the entire matrix if one element fails
|
fail-fast: false # don't abort the entire matrix if one element fails
|
||||||
matrix:
|
matrix:
|
||||||
@ -546,16 +722,22 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: install staticcheck
|
with:
|
||||||
run: GOBIN=~/.local/bin ./tool/go install honnef.co/go/tools/cmd/staticcheck
|
path: src
|
||||||
|
- name: Restore Go module cache
|
||||||
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||||
|
with:
|
||||||
|
path: gomodcache
|
||||||
|
key: ${{ needs.gomod-cache.outputs.cache-key }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
- name: run staticcheck
|
- name: run staticcheck
|
||||||
|
working-directory: src
|
||||||
run: |
|
run: |
|
||||||
export GOROOT=$(./tool/go env GOROOT)
|
export GOROOT=$(./tool/go env GOROOT)
|
||||||
export PATH=$GOROOT/bin:$PATH
|
./tool/go run -exec \
|
||||||
staticcheck -- $(./tool/go list ./... | grep -v tempfork)
|
"env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }}" \
|
||||||
env:
|
honnef.co/go/tools/cmd/staticcheck -- \
|
||||||
GOOS: ${{ matrix.goos }}
|
$(env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} ./tool/go list ./... | grep -v tempfork)
|
||||||
GOARCH: ${{ matrix.goarch }}
|
|
||||||
|
|
||||||
notify_slack:
|
notify_slack:
|
||||||
if: always()
|
if: always()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user