Continuous Integration, and Continuous Deployment for Go¶
This guide will help you to build configuration for a Go project on Scrutinizer. Notice that, Scrutinizer automatically infers your build configuration and test commands depending on your build system by default.
If you have a specific set-up, you can override the inferred commands in your configuration, or use a a minimal node to completely disable any inferred commands.
Setup Go Environment¶
Scrutinizer supports several Go versions. You can either specify a minor version or just use the latest for a given major version.
build: environment: go: 'go1.9.2' or 'go1.8'
Go Import Path¶
GOPATH is set to
$HOME/gopath, and your repository source code is placed in
If you use another Remote import path , you might need to
go_import_path in the configuration:
build: environment: go: version: 'go1.9.2' go_import_path: 'example.com/user/repo'
In case of
godep, Scrutinizer will also automatically set the correct
go_import_path for you.
If you would like to override the inferred commands, you can do so in your configuration:
build: nodes: my-tests: dependencies: override: - ./install-deps
If you use
make as build tool and have a
Makefile in your root folder, the inferred command will be:
go test will be inferred by default:
go test -v $(go list ./... | grep -v vendor)
In case that you would like to run a customized test script, you can override the default inferred command by adding them in your configuration:
build: nodes: my-tests: tests: override: - ./run-tests.sh
Scrutinizer supports default coverage file format of go tool Cover and
cobertura as well.
Cover as example, the configuration will look like:
build: nodes: tests-with-coverage: tests: override: - command: go test -coverprofile=cover.out coverage: file: 'cover.out' format: 'go-cc'
If you have multiple commands that generate code coverage data, we will automatically take care of merging.
Scrutinizer provides first-class support for deployment. Once all your tests have passed, it will automatically trigger deployment of your code. You can define deploy commands in your configuration:
build: nodes: deployment: requires: - branch: master - branch: /feature.*/ - node: my-tests # only runs if my-tests node succeeded commands: - deploy.sh
If your build benefits from multiple CPU cores, you can currently request up to 8 CPUs for your build. Simply, add the following to your configuration:
build: nodes: my-tests: resources: cpus: 4