Files
seaweedfs/seaweed-block/.github/workflows/test.yml
T
pingqiuandClaude Opus 5.5 6a38c27aa1 ci: use the Actions Go cache only on GitHub-hosted runners
The self-hosted runner keeps GOCACHE/GOMODCACHE on disk; the setup-go post
step uploading them (~4 GB) outlasted the 25-minute job timeout after all
tests had passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 08:57:46 -08:00

64 lines
2.3 KiB
YAML

name: Test
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
# One run per PR (or per branch for pushes). A new push to a PR cancels the
# superseded run; runs on main are never cancelled so every merge gets a result.
concurrency:
group: test-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
test:
name: go test (linux)
# Pushes and same-repo PRs run on the team's tp04 runner (seaweed.slice,
# capped at 8 cores / 8 GiB). Fork PRs never reach it: they stay on a
# GitHub-hosted runner.
runs-on: ${{ (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && 'tp04-seaweed-block' || 'ubuntu-latest' }}
timeout-minutes: 25
env:
# Pure-Go build: no package in the default build needs cgo, and the
# hosted runner should not depend on a C toolchain being present.
CGO_ENABLED: "0"
steps:
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: go.mod
# The self-hosted runner keeps GOCACHE/GOMODCACHE on its own disk;
# uploading them as an Actions cache (~4 GB) in the post step
# outlasted the job timeout after every test had passed. Only the
# GitHub-hosted (fork PR) runner uses the Actions cache.
cache: ${{ runner.environment == 'github-hosted' }}
cache-dependency-path: go.sum
- name: Go version
run: go version
- name: Build
run: go build ./...
- name: Vet
run: go vet ./...
- name: Test default configuration
run: go test -p=1 -short -count=1 -timeout 10m ./...
- name: Test legacy-fixture configuration
# Legacy-input fixtures and native caller controls stay executable after
# their constructors move behind the explicit test-only build tag.
# Bound package concurrency for existing short wall-clock assertions.
run: go test -p=1 -short -tags=swblock_format_v3_test -count=1 -timeout 10m ./...