matrix

package
v0.0.0-...-cba18c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package matrix provides a utility for running a single Go command

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner struct {
	// The number of single architecture-version runners that are active at any time.
	Parallelism int
	// List of Go versions to run commands on.
	// These should all be non-beta/RC versions.
	Versions []goversion.GoVersion
	// List of Go architectures (values for GOARCH) to run commands on.
	Architectures []string
	// The root directory that the matrix runner should use to install the Go toolchain versions.
	InstallDirectory string
	// Constructs the command to run for the single architecture-version runner.
	// The implementation should use `exec.CommandContext` and pass in the supplied context
	// to ensure that the command is cancelled if the runner exits early.
	// The GOARCH environment variable is automatically injected with the appropriate value.
	// Additionally, the value of `Path` is ignored
	// and replaced with the path to the installed Go binary.
	// Finally, due to a quirk with how the toolchain install path is resolved,
	// the HOME environment variable is replaced with a synthetic value.
	//
	// To skip a version-architecture pair, return `nil` for this function.
	GetCommand func(ctx context.Context, version goversion.GoVersion, arch string, goExe string) *exec.Cmd
}

Runner contains the logic used to run a single Go command on a matrix of Go toolchain version and Go architecture combinations. It handles downloading the Go toolchains for each version to the provided `InstallDirectory`, which can be cached to speed up future runs.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

Run runs the matrix runner to completion, exiting early (and dumping the output) if any of the individual commands fail. Otherwise, it runs a command for every combination of Go version and architecture.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL