Skip to main content

Building Runix

Prerequisites​

  • Go 1.25.7 or later
  • Make (optional)

Or use the Nix dev shell (provides Go, gopls, golangci-lint, goreleaser):

nix develop

See Nix Integration for full Nix documentation.

Build Commands​

# Build the binary
make build
# Output: bin/runix

# Run all tests with race detector
make test

# Run go vet
make vet

# Run golangci-lint (silently skipped if not installed)
make lint

# Format code
make fmt

# Clean build artifacts
make clean

Build Details​

The Makefile builds with:

CGO_ENABLED=0 go build -trimpath \
-ldflags "-X github.com/runixio/runix/internal/version.Version=$(shell git describe --tags 2>/dev/null || echo dev) \
-X github.com/runixio/runix/internal/version.BuildTime=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o bin/runix ./cmd/runix

Key flags:

  • CGO_ENABLED=0 — Fully static binary, no C dependencies
  • -trimpath — Removes local paths from the binary for reproducible builds
  • -ldflags -X — Injects version and build time at link time

Targeted Testing​

# Single package
go test ./internal/supervisor/...

# Single test
go test -run TestName ./internal/config/...

# E2E tests (no race flag, longer timeout)
go test -v -count=1 -timeout 120s ./internal/e2e/...

Full CI Reproduction​

make test && go test -v -count=1 -timeout 120s ./internal/e2e/...

CI runs make test (unit tests with race detector) first, then the E2E suite separately without -race.

Cross-Compilation​

For manual cross-compilation:

GOOS=linux GOARCH=arm64 go build -o bin/runix-linux-arm64 ./cmd/runix
GOOS=darwin GOARCH=arm64 go build -o bin/runix-darwin-arm64 ./cmd/runix
GOOS=windows GOARCH=amd64 go build -o bin/runix-windows-amd64.exe ./cmd/runix

For releases, GoReleaser handles cross-compilation automatically. See Release.

What's Next​