make cover ran the real-image workload tests inside the test job's coverage pass, and the realimages job then ran them again under -race, only after test had finished. A runtime PR held one runner for over an hour and then a second. Under load, packages/runtime alone outran its 40-minute coverage timeout (#615, #636). make cover is now two passes and a check: - cover-main: the ordinary suite, without the realimages tag; - cover-realimages: packages/runtime with -tags=realimages under -race; - cover-check: the two profiles concatenated, which check-coverage.sh already reads as covered-if-either-ran. In CI, test runs cover-main and realimages runs cover-realimages, side by side; a new coverage job checks the union. realimages now runs for every changed PR, so the union is always complete, and its scope output and hand-kept -run list are gone: the tag and the whole runtime package select the tests. That is still less work than before, when every PR ran the real-image tests in make cover and runtime PRs ran them twice. Agreed in #640.
66 lines
2.9 KiB
Makefile
66 lines
2.9 KiB
Makefile
PROTO_FILES := $(wildcard proto/sisyphus/v1/*.proto) $(wildcard proto/sisyphus/node/v1/*.proto)
|
|
# STATICCHECK is the version of staticcheck that make lint and CI run.
|
|
STATICCHECK := 2026.2.2
|
|
COVERED := ./apps/...,./packages/ai/...,./packages/geo/...,./packages/hardware/...,./packages/identity/...,./packages/ipfscluster/...,./packages/job-model/...,./packages/jobrecord/...,./packages/kubo/...,./packages/names/...,./packages/natpmp/...,./packages/nodedb/...,./packages/runtime/...,./packages/s3/...,./packages/sealed/...,./packages/storage/...,./packages/stun/...
|
|
|
|
.PHONY: build test cover cover-main cover-realimages cover-check demo proto tools fmt lint
|
|
|
|
build:
|
|
go build -o bin/sisyphusd ./apps/sisyphusd
|
|
|
|
test:
|
|
go vet ./...
|
|
go test -race -timeout 25m ./...
|
|
|
|
# Fails unless the tests execute every statement of hand-written code.
|
|
# Generated protocol code is not counted. The tests that need Kubo, IPFS
|
|
# Cluster or Docker are required, as in CI, so that one missing program
|
|
# fails with its name rather than as a list of blocks no test ran. Set any
|
|
# of these to nothing to skip those tests, knowing coverage will then fail.
|
|
#
|
|
# It runs in two passes, which CI runs as two jobs side by side: the
|
|
# ordinary suite, and the runtime package with its real-image workload tests
|
|
# (the realimages tag) under the race detector. A statement counts as covered
|
|
# if either pass ran it.
|
|
cover: cover-main cover-realimages cover-check
|
|
|
|
cover-main cover-realimages: export SISYPHUS_REQUIRE_KUBO ?= 1
|
|
cover-main cover-realimages: export SISYPHUS_REQUIRE_CLUSTER ?= 1
|
|
cover-main cover-realimages: export SISYPHUS_REQUIRE_DOCKER ?= 1
|
|
cover-main:
|
|
go test -count=1 -timeout 40m -coverpkg=$(COVERED) -coverprofile=coverage.out ./...
|
|
cover-realimages:
|
|
go test -race -tags=realimages -count=1 -timeout 60m -coverpkg=$(COVERED) -coverprofile=realimages.out ./packages/runtime
|
|
|
|
# check-coverage.sh counts a block as covered if any of its appearances ran,
|
|
# so the two profiles join by concatenation, the second without its mode line.
|
|
cover-check:
|
|
{ cat coverage.out; tail -n +2 realimages.out; } > union.out
|
|
./scripts/check-coverage.sh union.out
|
|
|
|
# Runs a three-node pool and a job on this machine, in one terminal.
|
|
demo:
|
|
./scripts/demo.sh
|
|
|
|
# lint looks for mistakes the compiler and vet let through.
|
|
lint:
|
|
go vet ./...
|
|
go run honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK) ./...
|
|
|
|
fmt:
|
|
gofmt -w apps packages
|
|
|
|
# Regenerates packages/protocol from proto/, and the desktop's TypeScript
|
|
# client in packages/client from the node's local API. Needs protoc, `make
|
|
# tools`, and `npm ci` in apps/sisyphus.
|
|
proto:
|
|
protoc -I proto \
|
|
--go_out=packages/protocol --go_opt=paths=source_relative \
|
|
--go-grpc_out=packages/protocol --go-grpc_opt=paths=source_relative \
|
|
$(PROTO_FILES)
|
|
npm --prefix apps/sisyphus run proto:generate
|
|
|
|
tools:
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.12
|
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.6.2
|