Documentation ¶
Index ¶
- Constants
- Variables
- func Archive(ctx context.Context, dir string, filename string) (err error)
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func Build(ctx context.Context, dir, tag, version string, noCache bool, output io.Writer) (err error)
- func Dockerfile(travis *Travis, opt *DockerfileOpt, archive string) (res []byte, err error)
- func Entrypoint(travis *Travis) (res []byte, err error)
- func MustAsset(name string) []byte
- func PrepareBaseImage(ctx context.Context, ref string, output io.Writer) (err error)
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func Run(c *cli.Context) error
- func Start(ctx context.Context, tag, name string, env []string, output io.Writer) (err error)
- type Display
- type DisplayUpdateFunc
- type DisplayUpdateHandler
- type DockerfileOpt
- type Env
- type ErrorSet
- type Header
- type ListOrString
- type Matrix
- type RunOpt
- type Section
- type TestCase
- type TestCaseSet
- type Travis
Constants ¶
const DockerfileAsset = "assets/Dockerfile"
DockerfileAsset defines a asset name for Dockerfile.
const EntrypointAsset = "assets/entrypoint"
EntrypointAsset defines a asset name for entrypoint.sh.
const SourceArchive = "source.tar.gz"
SourceArchive defines a name of source archive file.
Variables ¶
var ( // ErrUnknownPythonVersion is returned when the given python version is not // supported. ErrUnknownPythonVersion = fmt.Errorf("Given Python version is not supported") )
Functions ¶
func Asset ¶ added in v0.3.1
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶ added in v0.3.1
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶ added in v0.3.1
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetNames ¶ added in v0.3.1
func AssetNames() []string
AssetNames returns the names of the assets.
func Build ¶
func Build(ctx context.Context, dir, tag, version string, noCache bool, output io.Writer) (err error)
Build builds a docker image from a directory. The built image named tag. The directory must have Dockerfile.
func Dockerfile ¶ added in v0.3.0
func Dockerfile(travis *Travis, opt *DockerfileOpt, archive string) (res []byte, err error)
Dockerfile creates a Dockerfile from an instance of Travis.
func Entrypoint ¶
Entrypoint creates an entrypoint.sh from an instance of Travis.
func MustAsset ¶ added in v0.3.1
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func PrepareBaseImage ¶ added in v0.5.0
PrepareBaseImage pulls a docker images represented by the given ref if necessary; it also writes summarized lorring information to the given output.
func RestoreAsset ¶ added in v0.3.1
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶ added in v0.3.1
RestoreAssets restores an asset under the given directory recursively
func Start ¶
Start runs a container to run tests with a given context. This function creates a container from the image of the given tag name, and the created container has the given name. If the given name is empty, the container will have a random temporary name and be deleted after after all steps end. env is a list of environment variables to be passed to the created container.
Types ¶
type Display ¶ added in v0.5.0
type Display struct { MaxSection int Title string Header *Header // contains filtered or unexported fields }
Display represents a display which consists of several sections.
func NewDisplay ¶ added in v0.5.0
func NewDisplay(ctx context.Context, title string, maxSection int) (display *Display, nctx context.Context, err error)
NewDisplay creates a new display.
func (*Display) AddSection ¶ added in v0.5.0
AddSection adds a new section to this display.
func (*Display) DeleteSection ¶ added in v0.5.0
DeleteSection deletes the given section from this display.
type DisplayUpdateFunc ¶ added in v0.5.0
type DisplayUpdateFunc func(handler DisplayUpdateHandler)
DisplayUpdateFunc is a function which a section calls to update the section body.
type DisplayUpdateHandler ¶ added in v0.5.0
DisplayUpdateHandler defines a handler function to update section body.
type DockerfileOpt ¶ added in v0.2.0
type DockerfileOpt struct { // Customize FROM clause. BaseImage string // Git repository. Repository string // URL for an Apt proxy. AptProxy string // URL for a pypi proxy. PypiProxy string // URL for a HTTP proxy. HTTPProxy string // URL for a HTTPS proxy. HTTPSProxy string // Comma separated URL lists. NoProxy string }
DockerfileOpt defines option variables used in Dockerfile templates.
type Env ¶ added in v0.4.0
type Env struct { Global []string `yaml:"global,omitempty"` Matrix []string `yaml:"matrix,omitempty"` }
Env defines the full structure of a definition of environment variables.
func (*Env) UnmarshalYAML ¶ added in v0.4.2
UnmarshalYAML defines a way to unmarshal variables of Env.
type ErrorSet ¶ added in v0.5.0
type ErrorSet struct {
// contains filtered or unexported fields
}
ErrorSet is a goroutine-safe set of errors. Each error in this set has a key and GetList function returns a list of errors according to the order of keys.
type ListOrString ¶ added in v0.4.2
type ListOrString []string
ListOrString defines an ambiguous type for YAML document, which can take a list of strings by default but also a single string literal.
func (*ListOrString) UnmarshalYAML ¶ added in v0.4.2
func (e *ListOrString) UnmarshalYAML(unmarshal func(interface{}) error) (err error)
UnmarshalYAML defines a way to unmarshal variables of ListOrString.
type Matrix ¶ added in v0.3.0
type Matrix struct { Include []interface{} `yaml:"include,omitempty"` Exclude []interface{} `yaml:"exclude,omitempty"` }
Matrix defines the structure of matrix element in .travis.yml.
type RunOpt ¶ added in v0.1.2
type RunOpt struct { // Same options as DockerfileOpt. *DockerfileOpt // Travis configuration file. Filename string // Container name. Name string // Runtime version to which only versions matching will be run. Version string // Image tag. Tag string // Max processors to be used. Processors int // If true, logging information to be stored to files. OutputLog bool // If true, not using cache during buidling a docker image. NoCache bool // If true, omit printing color codes. NoColor bool // Printed on the header. Title string }
RunOpt defines a option parameter for run function.
type Section ¶ added in v0.5.0
Section represents a section in a display. Each section has a header text and several strings as the body.
func (*Section) Writer ¶ added in v0.5.0
func (s *Section) Writer() io.WriteCloser
Writer returns io.WriteCloser to write messages into the section. Users have to close the returned writer.
type TestCase ¶ added in v0.5.2
TestCase is a set of environment variables and represented as a map of which a key is a name of one environment variable and the associated value is the value of the variable.
func (TestCase) Match ¶ added in v0.5.2
Match returns true if and only if the given TestCase has same configuration as this test case.
type TestCaseSet ¶ added in v0.4.0
TestCaseSet defines a set of arguments for build matrix. The test case set is a map of which key is a version and the associated value is a list of test cases.
type Travis ¶
type Travis struct { // Base language. Language string // List of addons. Addons struct { Apt struct { Packages []string } `yaml:"apt,omitempty"` } `yaml:"addons,omitempty"` // List of commands run before install steps. BeforeInstall ListOrString `yaml:"before_install,omitempty"` // List of commands used to install packages. Install ListOrString `yaml:"install,omitempty"` // List of commands run before main scripts. BeforeScript ListOrString `yaml:"before_script,omitempty"` // List of scripts. Script ListOrString `yaml:"script,omitempty"` // List of environment variables. Env Env `yaml:"env,omitempty"` // Configuration for matrix build. Matrix Matrix `yaml:"matrix,omitempty"` // List of python versions. (used only in python) Python []string `yaml:"python,omitempty"` // List of golang versions. (used only in go) Go []string `yaml:"go,omitempty"` // Go import path. (used only in go) GoImportPath string `yaml:"go_import_path,omitempty"` // Build args for go project. (used only in go) GoBuildArgs string `yaml:"gobuild_args,omitempty"` }
Travis defines the structure of .travis.yml.
func NewTravisFromFile ¶ added in v0.4.2
NewTravisFromFile creates a Travis object from a file.
func (*Travis) ArgumentSet ¶ added in v0.3.0
func (t *Travis) ArgumentSet(logger io.Writer) (res TestCaseSet, err error)
ArgumentSet returns a set of arguments to run entrypoint based on a build matrix.