Skip to content

Instantly share code, notes, and snippets.

@moemoe89
Created May 2, 2017 03:13
Show Gist options
  • Save moemoe89/54b21c92619e7193d9948111d3c599df to your computer and use it in GitHub Desktop.
Save moemoe89/54b21c92619e7193d9948111d3c599df to your computer and use it in GitHub Desktop.
Example Gitlab CI Setup for Go-Lang
image: golang:1.8.1
variables:
BIN_NAME: go-practice-ci
ARTIFACTS_DIR: artifacts
GO_PROJECT: gitlab.com/go-practice-ci
stages:
- build
- test
before_script:
- mkdir -p ${GOPATH}/src/${GO_PROJECT}
- mkdir -p ${CI_PROJECT_DIR}/${ARTIFACTS_DIR}
- go get github.com/tools/godep
- cp -r ${CI_PROJECT_DIR}/* ${GOPATH}/src/${GO_PROJECT}/
- cd ${GOPATH}/src/${GO_PROJECT}
build-my-project:
stage: build
script:
- godep restore
- godep go build -o ${CI_PROJECT_DIR}/${ARTIFACTS_DIR}/${BIN_NAME}
artifacts:
paths:
- ${ARTIFACTS_DIR}
test-my-project:
stage: test
script:
- godep restore
- godep go test -v -cover ./...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment