2023-02-11 20:16:15 +00:00
|
|
|
# This is our main "CI tests" workflow. It runs everything that should run on
|
|
|
|
# both PRs and merged commits, and for the latter reports failures to slack.
|
|
|
|
name: CI
|
|
|
|
|
2023-02-12 01:45:01 +00:00
|
|
|
env:
|
|
|
|
# Our fuzz job, powered by OSS-Fuzz, fails periodically because we upgrade to
|
|
|
|
# new Go versions very eagerly. OSS-Fuzz is a little more conservative, and
|
|
|
|
# ends up being unable to compile our code.
|
|
|
|
#
|
|
|
|
# When this happens, we want to disable the fuzz target until OSS-Fuzz catches
|
|
|
|
# up. However, we also don't want to forget to turn it back on when OSS-Fuzz
|
|
|
|
# can once again build our code.
|
|
|
|
#
|
|
|
|
# This variable toggles the fuzz job between two modes:
|
|
|
|
# - 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.
|
2023-02-17 01:12:03 +00:00
|
|
|
TS_FUZZ_CURRENTLY_BROKEN: false
|
2023-02-12 01:45:01 +00:00
|
|
|
|
2023-02-11 20:16:15 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "main"
|
|
|
|
- "release-branch/*"
|
|
|
|
pull_request:
|
.github: run tests on all PRs, regardless of branch name
The branch name selector "*" doesn't match branches with a "/" in their
name. The vast majority of our PRs are against the main (or previously,
master) branch anyway, so this will have minimal impact. But in the rare
cases that we want to open a PR against a branch with a "/" in the name,
tests should still run.
```
gh pr list --limit 9999 --state all --json baseRefName | \
jq -cs '.[] | group_by(.baseRefName) |
map({ base: .[0].baseRefName, count: map(.baseRefName) | length}) |
sort_by(-.count) | .[]'
{"base":"main","count":4593}
{"base":"master","count":226}
{"base":"release-branch/1.48","count":4}
{"base":"josh-and-adrian-io_uring","count":3}
{"base":"release-branch/1.30","count":3}
{"base":"release-branch/1.32","count":3}
{"base":"release-branch/1.20","count":2}
{"base":"release-branch/1.26","count":2}
{"base":"release-branch/1.34","count":2}
{"base":"release-branch/1.38","count":2}
{"base":"Aadi/speedtest-tailscaled","count":1}
{"base":"josh/io_uring","count":1}
{"base":"maisem/hi","count":1}
{"base":"rel-144","count":1}
{"base":"release-branch/1.18","count":1}
{"base":"release-branch/1.2","count":1}
{"base":"release-branch/1.22","count":1}
{"base":"release-branch/1.24","count":1}
{"base":"release-branch/1.4","count":1}
{"base":"release-branch/1.46","count":1}
{"base":"release-branch/1.8","count":1}
{"base":"web-client-main","count":1}
```
Updates #cleanup
Signed-off-by: Will Norris <will@tailscale.com>
2023-10-26 17:27:44 +00:00
|
|
|
# all PRs on all branches
|
2023-02-18 19:06:41 +00:00
|
|
|
merge_group:
|
2023-02-24 22:29:55 +00:00
|
|
|
branches:
|
|
|
|
- "main"
|
2023-02-11 20:16:15 +00:00
|
|
|
|
|
|
|
concurrency:
|
|
|
|
# For PRs, later CI runs preempt previous ones. e.g. a force push on a PR
|
|
|
|
# cancels running CI jobs and starts all new ones.
|
|
|
|
#
|
|
|
|
# For non-PR pushes, concurrency.group needs to be unique for every distinct
|
|
|
|
# CI run we want to have happen. Use run_id, which in practice means all
|
|
|
|
# non-PR CI runs will be allowed to run without preempting each other.
|
|
|
|
group: ${{ github.workflow }}-$${{ github.pull_request.number || github.run_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
2023-10-14 20:55:05 +00:00
|
|
|
race-root-integration:
|
|
|
|
runs-on: ubuntu-22.04
|
2023-10-17 01:47:03 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false # don't abort the entire matrix if one element fails
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- shard: '1/4'
|
|
|
|
- shard: '2/4'
|
|
|
|
- shard: '3/4'
|
|
|
|
- shard: '4/4'
|
2023-10-14 20:55:05 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: build test wrapper
|
|
|
|
run: ./tool/go build -o /tmp/testwrapper ./cmd/testwrapper
|
|
|
|
- name: integration tests as root
|
2023-10-14 23:56:08 +00:00
|
|
|
run: PATH=$PWD/tool:$PATH /tmp/testwrapper -exec "sudo -E" -race ./tstest/integration/
|
2023-10-17 01:47:03 +00:00
|
|
|
env:
|
|
|
|
TS_TEST_SHARD: ${{ matrix.shard }}
|
2023-10-14 20:55:05 +00:00
|
|
|
|
2023-02-11 20:16:15 +00:00
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false # don't abort the entire matrix if one element fails
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- goarch: amd64
|
2023-11-20 20:22:57 +00:00
|
|
|
coverflags: "-coverprofile=/tmp/coverage.out"
|
2023-02-11 20:16:15 +00:00
|
|
|
- goarch: amd64
|
2023-04-14 17:50:19 +00:00
|
|
|
buildflags: "-race"
|
2023-10-16 19:15:03 +00:00
|
|
|
shard: '1/3'
|
|
|
|
- goarch: amd64
|
|
|
|
buildflags: "-race"
|
|
|
|
shard: '2/3'
|
|
|
|
- goarch: amd64
|
|
|
|
buildflags: "-race"
|
|
|
|
shard: '3/3'
|
2023-02-11 20:16:15 +00:00
|
|
|
- goarch: "386" # thanks yaml
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-11 20:16:15 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-04-14 17:50:19 +00:00
|
|
|
- name: Restore Cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
# 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
|
|
|
|
~/go/pkg/mod/cache
|
|
|
|
~\AppData\Local\go-build
|
|
|
|
# The -2- here should be incremented when the scheme of data to be
|
|
|
|
# cached changes (e.g. path above changes).
|
2023-04-26 18:02:18 +00:00
|
|
|
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-2-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
|
2023-04-14 17:50:19 +00:00
|
|
|
restore-keys: |
|
2023-04-26 18:02:18 +00:00
|
|
|
${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-2-${{ hashFiles('**/go.sum') }}
|
2023-04-14 17:50:19 +00:00
|
|
|
${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-2-
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: build all
|
2023-10-15 02:11:44 +00:00
|
|
|
if: matrix.buildflags == '' # skip on race builder
|
2023-04-14 17:50:19 +00:00
|
|
|
run: ./tool/go build ${{matrix.buildflags}} ./...
|
2023-02-11 20:16:15 +00:00
|
|
|
env:
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
|
|
|
- name: build variant CLIs
|
2023-09-01 04:36:07 +00:00
|
|
|
if: matrix.buildflags == '' # skip on race builder
|
2023-02-11 20:16:15 +00:00
|
|
|
run: |
|
2023-02-18 06:07:19 +00:00
|
|
|
export TS_USE_TOOLCHAIN=1
|
2023-02-11 20:16:15 +00:00
|
|
|
./build_dist.sh --extra-small ./cmd/tailscaled
|
|
|
|
./build_dist.sh --box ./cmd/tailscaled
|
|
|
|
./build_dist.sh --extra-small --box ./cmd/tailscaled
|
|
|
|
rm -f tailscaled
|
|
|
|
env:
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
|
|
|
- name: get qemu # for tstest/archtest
|
2023-09-01 04:36:07 +00:00
|
|
|
if: matrix.goarch == 'amd64' && matrix.buildflags == ''
|
2023-02-11 20:16:15 +00:00
|
|
|
run: |
|
|
|
|
sudo apt-get -y update
|
|
|
|
sudo apt-get -y install qemu-user
|
|
|
|
- name: build test wrapper
|
|
|
|
run: ./tool/go build -o /tmp/testwrapper ./cmd/testwrapper
|
|
|
|
- name: test all
|
2023-11-20 20:22:57 +00:00
|
|
|
run: NOBASHDEBUG=true PATH=$PWD/tool:$PATH /tmp/testwrapper ${{matrix.coverflags}} ./... ${{matrix.buildflags}}
|
2023-04-26 16:40:19 +00:00
|
|
|
env:
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
2023-10-16 19:15:03 +00:00
|
|
|
TS_TEST_SHARD: ${{ matrix.shard }}
|
2023-11-20 20:22:57 +00:00
|
|
|
- name: Publish to coveralls.io
|
|
|
|
if: matrix.coverflags != '' # only publish results if we've tracked coverage
|
|
|
|
uses: shogo82148/actions-goveralls@v1
|
|
|
|
with:
|
|
|
|
path-to-profile: /tmp/coverage.out
|
2023-04-26 16:40:19 +00:00
|
|
|
- name: bench all
|
2023-09-01 04:36:07 +00:00
|
|
|
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)
|
2023-02-11 20:16:15 +00:00
|
|
|
env:
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
|
|
|
- name: check that no tracked files changed
|
|
|
|
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
|
|
|
|
run: |
|
|
|
|
# Note: The "error: pathspec..." you see below is normal!
|
|
|
|
# In the success case in which there are no new untracked files,
|
|
|
|
# git ls-files complains about the pathspec not matching anything.
|
|
|
|
# That's OK. It's not worth the effort to suppress. Please ignore it.
|
|
|
|
if git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*'
|
|
|
|
then
|
|
|
|
echo "Build/test created untracked files in the repo (file names above)."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
windows:
|
2023-02-12 00:52:27 +00:00
|
|
|
runs-on: windows-2022
|
2023-02-11 20:16:15 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-04-14 18:09:21 +00:00
|
|
|
|
|
|
|
- name: Install Go
|
2023-04-17 11:57:59 +00:00
|
|
|
uses: actions/setup-go@v4
|
2023-04-14 18:09:21 +00:00
|
|
|
with:
|
|
|
|
go-version-file: go.mod
|
|
|
|
cache: false
|
|
|
|
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: Restore Cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
# 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: |
|
2023-04-14 17:50:19 +00:00
|
|
|
~/.cache/go-build
|
2023-02-11 20:16:15 +00:00
|
|
|
~/go/pkg/mod/cache
|
|
|
|
~\AppData\Local\go-build
|
|
|
|
# The -2- here should be incremented when the scheme of data to be
|
|
|
|
# cached changes (e.g. path above changes).
|
2023-04-26 18:02:18 +00:00
|
|
|
key: ${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
|
2023-04-14 17:50:19 +00:00
|
|
|
restore-keys: |
|
2023-04-26 18:02:18 +00:00
|
|
|
${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}
|
2023-04-14 17:50:19 +00:00
|
|
|
${{ github.job }}-${{ runner.os }}-go-2-
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: test
|
2023-08-31 21:55:57 +00:00
|
|
|
run: go run ./cmd/testwrapper ./...
|
|
|
|
- name: bench all
|
2023-02-11 20:16:15 +00:00
|
|
|
# Don't use -bench=. -benchtime=1x.
|
|
|
|
# Somewhere in the layers (powershell?)
|
|
|
|
# the equals signs cause great confusion.
|
2023-08-31 21:55:57 +00:00
|
|
|
run: go test ./... -bench . -benchtime 1x -run "^$"
|
2023-02-11 20:16:15 +00:00
|
|
|
|
2023-10-18 18:22:28 +00:00
|
|
|
privileged:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
container:
|
|
|
|
image: golang:latest
|
|
|
|
options: --privileged
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: chown
|
|
|
|
run: chown -R $(id -u):$(id -g) $PWD
|
|
|
|
- name: privileged tests
|
|
|
|
run: ./tool/go test ./util/linuxfw
|
|
|
|
|
2023-02-11 20:16:15 +00:00
|
|
|
vm:
|
|
|
|
runs-on: ["self-hosted", "linux", "vm"]
|
|
|
|
# VM tests run with some privileges, don't let them run on 3p PRs.
|
|
|
|
if: github.repository == 'tailscale/tailscale'
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: Run VM tests
|
|
|
|
run: ./tool/go test ./tstest/integration/vms -v -no-s3 -run-vm-tests -run=TestRunUbuntu2004
|
|
|
|
env:
|
|
|
|
HOME: "/tmp"
|
|
|
|
TMPDIR: "/tmp"
|
|
|
|
XDB_CACHE_HOME: "/var/lib/ghrunner/cache"
|
2023-10-15 02:11:44 +00:00
|
|
|
|
|
|
|
race-build:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: build all
|
|
|
|
run: ./tool/go install -race ./cmd/...
|
|
|
|
- name: build tests
|
|
|
|
run: ./tool/go test -race -exec=true ./...
|
|
|
|
|
2023-02-11 20:16:15 +00:00
|
|
|
cross: # cross-compile checks, build only.
|
|
|
|
strategy:
|
|
|
|
fail-fast: false # don't abort the entire matrix if one element fails
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
# Note: linux/amd64 is not in this matrix, because that goos/goarch is
|
|
|
|
# tested more exhaustively in the 'test' job above.
|
|
|
|
- goos: linux
|
|
|
|
goarch: arm64
|
|
|
|
- goos: linux
|
|
|
|
goarch: "386" # thanks yaml
|
|
|
|
- goos: linux
|
|
|
|
goarch: loong64
|
2023-02-12 02:31:50 +00:00
|
|
|
- goos: linux
|
|
|
|
goarch: arm
|
|
|
|
goarm: "5"
|
|
|
|
- goos: linux
|
|
|
|
goarch: arm
|
|
|
|
goarm: "7"
|
2023-02-11 20:16:15 +00:00
|
|
|
# macOS
|
|
|
|
- goos: darwin
|
|
|
|
goarch: amd64
|
|
|
|
- goos: darwin
|
|
|
|
goarch: arm64
|
|
|
|
# Windows
|
|
|
|
- goos: windows
|
|
|
|
goarch: amd64
|
|
|
|
- goos: windows
|
|
|
|
goarch: arm64
|
|
|
|
# BSDs
|
|
|
|
- goos: freebsd
|
|
|
|
goarch: amd64
|
|
|
|
- goos: openbsd
|
|
|
|
goarch: amd64
|
2024-01-20 00:07:44 +00:00
|
|
|
# Plan9 (disabled until 3p dependencies are fixed)
|
|
|
|
# - goos: plan9
|
|
|
|
# goarch: amd64
|
2023-02-11 20:16:15 +00:00
|
|
|
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-11 20:16:15 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-04-14 17:50:19 +00:00
|
|
|
- name: Restore Cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
# 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
|
|
|
|
~/go/pkg/mod/cache
|
|
|
|
~\AppData\Local\go-build
|
|
|
|
# The -2- here should be incremented when the scheme of data to be
|
|
|
|
# cached changes (e.g. path above changes).
|
2023-04-26 18:02:18 +00:00
|
|
|
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
|
2023-04-14 17:50:19 +00:00
|
|
|
restore-keys: |
|
2023-04-26 18:02:18 +00:00
|
|
|
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}
|
2023-04-14 17:50:19 +00:00
|
|
|
${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: build all
|
|
|
|
run: ./tool/go build ./cmd/...
|
|
|
|
env:
|
|
|
|
GOOS: ${{ matrix.goos }}
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
2023-02-12 02:31:50 +00:00
|
|
|
GOARM: ${{ matrix.goarm }}
|
2023-02-11 20:16:15 +00:00
|
|
|
CGO_ENABLED: "0"
|
|
|
|
- name: build tests
|
2023-02-12 02:08:31 +00:00
|
|
|
run: ./tool/go test -exec=true ./...
|
2023-02-11 20:16:15 +00:00
|
|
|
env:
|
|
|
|
GOOS: ${{ matrix.goos }}
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
|
|
|
CGO_ENABLED: "0"
|
|
|
|
|
|
|
|
ios: # similar to cross above, but iOS can't build most of the repo. So, just
|
|
|
|
#make it build a few smoke packages.
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-11 20:16:15 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: build some
|
|
|
|
run: ./tool/go build ./ipn/... ./wgengine/ ./types/... ./control/controlclient
|
|
|
|
env:
|
|
|
|
GOOS: ios
|
|
|
|
GOARCH: arm64
|
|
|
|
|
2023-02-12 00:26:10 +00:00
|
|
|
android:
|
|
|
|
# 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,
|
|
|
|
# only test the subset of android that our past smoke test checked.
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-12 00:26:10 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-02-12 00:26:10 +00:00
|
|
|
# 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
|
|
|
|
# some Android breakages early.
|
|
|
|
# TODO(bradfitz): better; see https://github.com/tailscale/tailscale/issues/4482
|
|
|
|
- name: build some
|
|
|
|
run: ./tool/go install ./net/netns ./ipn/ipnlocal ./wgengine/magicsock/ ./wgengine/ ./wgengine/router/ ./wgengine/netstack ./util/dnsname/ ./ipn/ ./net/interfaces ./wgengine/router/ ./tailcfg/ ./types/logger/ ./net/dns ./hostinfo ./version
|
|
|
|
env:
|
|
|
|
GOOS: android
|
|
|
|
GOARCH: arm64
|
|
|
|
|
2023-02-11 20:16:15 +00:00
|
|
|
wasm: # builds tsconnect, which is the only wasm build we support
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-11 20:16:15 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-04-14 17:50:19 +00:00
|
|
|
- name: Restore Cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
# 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
|
|
|
|
~/go/pkg/mod/cache
|
|
|
|
~\AppData\Local\go-build
|
|
|
|
# The -2- here should be incremented when the scheme of data to be
|
|
|
|
# cached changes (e.g. path above changes).
|
2023-04-26 18:02:18 +00:00
|
|
|
key: ${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
|
2023-04-14 17:50:19 +00:00
|
|
|
restore-keys: |
|
2023-04-26 18:02:18 +00:00
|
|
|
${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}
|
2023-04-14 17:50:19 +00:00
|
|
|
${{ github.job }}-${{ runner.os }}-go-2-
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: build tsconnect client
|
|
|
|
run: ./tool/go build ./cmd/tsconnect/wasm ./cmd/tailscale/cli
|
|
|
|
env:
|
|
|
|
GOOS: js
|
|
|
|
GOARCH: wasm
|
|
|
|
- name: build tsconnect server
|
|
|
|
# Note, no GOOS/GOARCH in env on this build step, we're running a build
|
|
|
|
# tool that handles the build itself.
|
|
|
|
run: |
|
|
|
|
./tool/go run ./cmd/tsconnect --fast-compression build
|
|
|
|
./tool/go run ./cmd/tsconnect --fast-compression build-pkg
|
|
|
|
|
2023-04-12 22:50:52 +00:00
|
|
|
tailscale_go: # Subset of tests that depend on our custom Go toolchain.
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-04-12 22:50:52 +00:00
|
|
|
- name: test tailscale_go
|
|
|
|
run: ./tool/go test -tags=tailscale_go,ts_enable_sockstats ./net/sockstats/...
|
|
|
|
|
|
|
|
|
2023-02-11 20:16:15 +00:00
|
|
|
fuzz:
|
2023-02-12 01:45:01 +00:00
|
|
|
# This target periodically breaks (see TS_FUZZ_CURRENTLY_BROKEN at the top
|
|
|
|
# of the file), so it's more complex than usual: the 'build fuzzers' step
|
|
|
|
# might fail, and depending on the value of 'TS_FUZZ_CURRENTLY_BROKEN', that
|
|
|
|
# might or might not be fine. The steps after the build figure out whether
|
|
|
|
# the success/failure is expected, and appropriately pass/fail the job
|
|
|
|
# overall accordingly.
|
|
|
|
#
|
|
|
|
# Practically, this means that all steps after 'build fuzzers' must have an
|
|
|
|
# explicit 'if' condition, because the default condition for steps is
|
|
|
|
# 'success()', meaning "only run this if no previous steps failed".
|
2023-02-11 20:16:15 +00:00
|
|
|
if: github.event_name == 'pull_request'
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-11 20:16:15 +00:00
|
|
|
steps:
|
|
|
|
- name: build fuzzers
|
|
|
|
id: build
|
|
|
|
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
2023-02-12 01:45:01 +00:00
|
|
|
# continue-on-error makes steps.build.conclusion be 'success' even if
|
|
|
|
# steps.build.outcome is 'failure'. This means this step does not
|
|
|
|
# contribute to the job's overall pass/fail evaluation.
|
|
|
|
continue-on-error: true
|
2023-02-11 20:16:15 +00:00
|
|
|
with:
|
2023-02-12 01:45:01 +00:00
|
|
|
oss-fuzz-project-name: 'tailscale'
|
|
|
|
dry-run: false
|
|
|
|
language: go
|
|
|
|
- name: report unexpectedly broken fuzz build
|
|
|
|
if: steps.build.outcome == 'failure' && env.TS_FUZZ_CURRENTLY_BROKEN != 'true'
|
|
|
|
run: |
|
|
|
|
echo "fuzzer build failed, see above for why"
|
|
|
|
echo "if the failure is due to OSS-Fuzz not being on the latest Go yet,"
|
|
|
|
echo "set TS_FUZZ_CURRENTLY_BROKEN=true in .github/workflows/test.yml"
|
|
|
|
echo "to temporarily disable fuzzing until OSS-Fuzz works again."
|
|
|
|
exit 1
|
|
|
|
- name: report unexpectedly working fuzz build
|
|
|
|
if: steps.build.outcome == 'success' && env.TS_FUZZ_CURRENTLY_BROKEN == 'true'
|
|
|
|
run: |
|
|
|
|
echo "fuzzer build succeeded, but we expect it to be broken"
|
|
|
|
echo "please set TS_FUZZ_CURRENTLY_BROKEN=false in .github/workflows/test.yml"
|
|
|
|
echo "to reenable fuzz testing"
|
|
|
|
exit 1
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: run fuzzers
|
2023-02-12 01:45:01 +00:00
|
|
|
id: run
|
|
|
|
# Run the fuzzers whenever they're able to build, even if we're going to
|
|
|
|
# report a failure because TS_FUZZ_CURRENTLY_BROKEN is set to the wrong
|
|
|
|
# value.
|
|
|
|
if: steps.build.outcome == 'success'
|
2023-02-11 20:16:15 +00:00
|
|
|
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
|
|
|
with:
|
|
|
|
oss-fuzz-project-name: 'tailscale'
|
|
|
|
fuzz-seconds: 300
|
|
|
|
dry-run: false
|
|
|
|
language: go
|
|
|
|
- name: upload crash
|
|
|
|
uses: actions/upload-artifact@v3
|
2023-02-12 01:45:01 +00:00
|
|
|
if: steps.run.outcome != 'success' && steps.build.outcome == 'success'
|
2023-02-11 20:16:15 +00:00
|
|
|
with:
|
|
|
|
name: artifacts
|
|
|
|
path: ./out/artifacts
|
|
|
|
|
|
|
|
depaware:
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-11 20:16:15 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: check depaware
|
|
|
|
run: |
|
|
|
|
export PATH=$(./tool/go env GOROOT)/bin:$PATH
|
|
|
|
find . -name 'depaware.txt' | xargs -n1 dirname | xargs ./tool/go run github.com/tailscale/depaware --check
|
|
|
|
|
|
|
|
go_generate:
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-11 20:16:15 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: check that 'go generate' is clean
|
|
|
|
run: |
|
2023-12-04 10:18:07 +00:00
|
|
|
pkgs=$(./tool/go list ./... | grep -Ev 'dnsfallback|k8s-operator')
|
2023-02-11 20:16:15 +00:00
|
|
|
./tool/go generate $pkgs
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
git diff --name-only --exit-code || (echo "The files above need updating. Please run 'go generate'."; exit 1)
|
|
|
|
|
|
|
|
go_mod_tidy:
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-11 20:16:15 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: check that 'go mod tidy' is clean
|
|
|
|
run: |
|
|
|
|
./tool/go mod tidy
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
git diff --name-only --exit-code || (echo "Please run 'go mod tidy'."; exit 1)
|
|
|
|
|
|
|
|
licenses:
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-11 20:16:15 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: check licenses
|
|
|
|
run: ./scripts/check_license_headers.sh .
|
|
|
|
|
|
|
|
staticcheck:
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-11 20:16:15 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false # don't abort the entire matrix if one element fails
|
|
|
|
matrix:
|
|
|
|
goos: ["linux", "windows", "darwin"]
|
|
|
|
goarch: ["amd64"]
|
|
|
|
include:
|
|
|
|
- goos: "windows"
|
|
|
|
goarch: "386"
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-04 21:37:58 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-02-11 20:16:15 +00:00
|
|
|
- name: install staticcheck
|
|
|
|
run: GOBIN=~/.local/bin ./tool/go install honnef.co/go/tools/cmd/staticcheck
|
|
|
|
- name: run staticcheck
|
|
|
|
run: |
|
|
|
|
export GOROOT=$(./tool/go env GOROOT)
|
|
|
|
export PATH=$GOROOT/bin:$PATH
|
|
|
|
staticcheck -- $(./tool/go list ./... | grep -v tempfork)
|
|
|
|
env:
|
|
|
|
GOOS: ${{ matrix.goos }}
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
|
|
|
|
|
|
|
notify_slack:
|
2023-02-18 22:19:10 +00:00
|
|
|
if: always()
|
2023-02-11 20:16:15 +00:00
|
|
|
# Any of these jobs failing causes a slack notification.
|
|
|
|
needs:
|
2023-02-12 00:26:10 +00:00
|
|
|
- android
|
2023-02-11 20:16:15 +00:00
|
|
|
- test
|
|
|
|
- windows
|
|
|
|
- vm
|
|
|
|
- cross
|
|
|
|
- ios
|
|
|
|
- wasm
|
2023-04-12 22:50:52 +00:00
|
|
|
- tailscale_go
|
2023-02-11 20:16:15 +00:00
|
|
|
- fuzz
|
|
|
|
- depaware
|
|
|
|
- go_generate
|
|
|
|
- go_mod_tidy
|
|
|
|
- licenses
|
|
|
|
- staticcheck
|
2023-02-12 00:51:35 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-02-11 20:16:15 +00:00
|
|
|
steps:
|
|
|
|
- name: notify
|
2023-02-18 22:19:10 +00:00
|
|
|
# Only notify slack for merged commits, not PR failures.
|
|
|
|
#
|
|
|
|
# It may be tempting to move this condition into the job's 'if' block, but
|
|
|
|
# don't: Github only collapses the test list into "everything is OK" if
|
|
|
|
# all jobs succeeded. A skipped job results in the list staying expanded.
|
|
|
|
# By having the job always run, but skipping its only step as needed, we
|
|
|
|
# let the CI output collapse nicely in PRs.
|
|
|
|
if: failure() && github.event_name == 'push'
|
2023-03-13 11:58:08 +00:00
|
|
|
uses: ruby/action-slack@v3.2.1
|
2023-02-11 20:16:15 +00:00
|
|
|
with:
|
|
|
|
payload: |
|
|
|
|
{
|
|
|
|
"attachments": [{
|
|
|
|
"title": "Failure: ${{ github.workflow }}",
|
|
|
|
"title_link": "https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks",
|
|
|
|
"text": "${{ github.repository }}@${{ github.ref_name }}: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>",
|
|
|
|
"fields": [{ "value": ${{ toJson(github.event.head_commit.message) }}, "short": false }],
|
|
|
|
"footer": "${{ github.event.head_commit.committer.name }} at ${{ github.event.head_commit.timestamp }}",
|
|
|
|
"color": "danger"
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
2023-02-24 22:48:58 +00:00
|
|
|
|
|
|
|
check_mergeability:
|
|
|
|
if: always()
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
needs:
|
|
|
|
- android
|
|
|
|
- test
|
|
|
|
- windows
|
|
|
|
- vm
|
|
|
|
- cross
|
|
|
|
- ios
|
|
|
|
- wasm
|
2023-04-12 22:50:52 +00:00
|
|
|
- tailscale_go
|
2023-02-24 22:48:58 +00:00
|
|
|
- fuzz
|
|
|
|
- depaware
|
|
|
|
- go_generate
|
|
|
|
- go_mod_tidy
|
|
|
|
- licenses
|
|
|
|
- staticcheck
|
|
|
|
steps:
|
|
|
|
- name: Decide if change is okay to merge
|
|
|
|
if: github.event_name != 'push'
|
|
|
|
uses: re-actors/alls-green@release/v1
|
|
|
|
with:
|
|
|
|
jobs: ${{ toJSON(needs) }}
|