Files
spinifex/tests/e2e/Makefile
T
joshsiv-mulga 3b272295a0 ci(e2e-go): pre-build test binaries on runner; drop go toolchain from VM
Replaces the source-tree + go + gotestsum payload that the e2e-go.yml
workflow previously shipped to the tofu CI VM with self-contained
test binaries built on the runner via `go test -c`. testdata for the
LB suite is already //go:embed'd into the binaries, so the bundle on
the VM is just `<suite>.test` files (cert: 14M, lb: 17M uncompressed).

Workflow changes
- actions/setup-go on runner.
- New step builds binaries via `make e2e-build SUITES_BUILD=...`.
- Install go-junit-report on runner; convert each VM-side test log to
  junit-<suite>.xml after artifact pull so "Publish test summary" still
  parses JUnit XML.
- Drop "Install Go + gotestsum on VM" entirely (saves ~60s + network).
- Drop source-shipping rsync/tar (saves ~30s + a lot of bandwidth).
- VM step runs `./<suite>.test -test.v -test.timeout=30m` directly.

Makefile changes
- New `e2e-build` target compiles each `SUITES_BUILD` entry into
  `BIN_DIR/<suite>.test` via `go test -c -tags=e2e`. `clean` also
  removes BIN_DIR.

Closes mulga-siv-80.
2026-05-18 16:10:12 +10:00

52 lines
1.7 KiB
Makefile

PKG ?= ./cert/... ./lb/... ./multinode/... ./baremetal/... ./reboot/... ./tofu/...
ARTIFACT_DIR ?= /tmp/spinifex-e2e-artifacts
TIMEOUT ?= 30m
MODE ?= single
# GOTESTSUM=1 emits JUnit XML + JSON streams for CI. Suite tag derives from the
# first path component of PKG so per-suite targets get distinct artifact names.
GOTESTSUM ?=
SUITE_TAG ?= $(notdir $(patsubst %/...,%,$(firstword $(PKG))))
# Pre-built test binaries — see mulga-siv-80. `e2e-build` cross-compiles each
# named suite into BIN_DIR/<suite>.test so CI can ship binaries (not source +
# go toolchain) to the remote VM.
BIN_DIR ?= $(CURDIR)/_bin
SUITES_BUILD ?= cert lb
.PHONY: e2e e2e-cert e2e-lb e2e-multinode e2e-bm e2e-reboot e2e-tofu e2e-all clean e2e-build
ifeq ($(GOTESTSUM),1)
E2E_CMD = gotestsum \
--junitfile $(ARTIFACT_DIR)/junit-$(SUITE_TAG).xml \
--jsonfile $(ARTIFACT_DIR)/gotest-$(SUITE_TAG).json \
--format=testname \
-- -tags=e2e -timeout=$(TIMEOUT) $(PKG)
else
E2E_CMD = go test -tags=e2e -v -timeout=$(TIMEOUT) $(PKG)
endif
e2e:
@mkdir -p $(ARTIFACT_DIR)
SPINIFEX_E2E=1 \
SPINIFEX_MODE=$(MODE) \
ARTIFACT_DIR=$(ARTIFACT_DIR) \
$(E2E_CMD)
e2e-cert: ; $(MAKE) e2e PKG=./cert/...
e2e-lb: ; $(MAKE) e2e PKG=./lb/...
e2e-multinode: ; $(MAKE) e2e PKG=./multinode/...
e2e-bm: ; $(MAKE) e2e PKG=./baremetal/... MODE=baremetal
e2e-reboot: ; $(MAKE) e2e PKG=./reboot/...
e2e-tofu: ; $(MAKE) e2e PKG=./tofu/...
e2e-all: ; $(MAKE) e2e
e2e-build:
@mkdir -p $(BIN_DIR)
@for s in $(SUITES_BUILD); do \
echo "==> building $$s.test"; \
go test -c -tags=e2e -o $(BIN_DIR)/$$s.test ./$$s/ || exit 1; \
done
clean:
rm -rf $(ARTIFACT_DIR) $(BIN_DIR)