mirror of
https://github.com/burrowers/garble.git
synced 2026-04-22 23:57:14 +08:00
4326dcde14
The main "linux" job is the slowest by far at over 20 minutes. The CPU on the hosted Actions runners is very slow, but luckily, we get 20 concurrent Linux runners. Split the main Linux job further. Also, now that generics in Go are widespread, we no longer need a Go generics library for good coverage. While here, time each of the third party project commands.
104 lines
3.3 KiB
YAML
104 lines
3.3 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- ci-test
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
# Note that a full "go test" is quite heavy,
|
|
# as it runs many builds under the hood.
|
|
# The default -timeout=10m can be hit by the hosted runners.
|
|
#
|
|
# Also note that we don't use Actions caching for Go on purpose.
|
|
# Caching GOMODCACHE wouldn't help much, as we have few deps.
|
|
# Caching GOCACHE would do more harm than good,
|
|
# as the tests redo most of their work if the garble version changes,
|
|
# and the majority of commits or PRs will do so.
|
|
# Moreover, GitHub saves and restores caches via compressed archives over the
|
|
# network, which means it can easily add one minute of overhead on its own for
|
|
# just a few hundred megabytes worth of files.
|
|
|
|
name: Test
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
# We mainly develop on Linux, so being able to see MacOS and Windows failures
|
|
# is useful even if we already know at least one job will fail.
|
|
fail-fast: false
|
|
matrix:
|
|
go-version: [1.26.x]
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
cache: false
|
|
- run: go test -timeout=15m ./...
|
|
# macos and windows failures with bincmp can be hard to reproduce locally,
|
|
# so upload the binaries as artifacts.
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: bincmp_output
|
|
path: bincmp_output/
|
|
|
|
# Static checks from this point forward. Only run on one Go version and on
|
|
# linux, since it's the fastest platform, and the tools behave the same.
|
|
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.26.x'
|
|
run: ./scripts/crlf-test.sh
|
|
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.26.x'
|
|
run: diff <(echo -n) <(gofmt -d .)
|
|
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.26.x'
|
|
run: go vet ./...
|
|
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.26.x'
|
|
uses: dominikh/staticcheck-action@v1
|
|
with:
|
|
version: "2025.1"
|
|
install-go: false
|
|
|
|
# We don't care about GOARCH=386 particularly, hence -short,
|
|
# but it helps ensure we support 32-bit hosts and targets well.
|
|
# TODO: use CGO_ENABLED=1 once we figure out how to install gcc-multilib,
|
|
# and once gotooltest forwards the value of CGO_ENABLED to the scripts.
|
|
test-386:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GOARCH: 386
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.26.x
|
|
cache: false
|
|
- run: go test -short ./...
|
|
|
|
# Only run the short tests with -race, because otherwise the overhead is too much.
|
|
# We only test on Linux, as races are unlikely to be OS-specific.
|
|
# We use GOAMD64=v3 because that significantly speeds up the race detector.
|
|
test-race:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GOAMD64: v3
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.26.x
|
|
cache: false
|
|
- run: go test -short -race ./...
|
|
|
|
test-third-party:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.26.x
|
|
cache: false
|
|
- run: go install
|
|
- run: ./scripts/check-third-party.sh
|