-
-
Save alexyslozada/1e2a9d5416918400204dd8268c62ad76 to your computer and use it in GitHub Desktop.
Example Gitlab CI Setup for Go-Lang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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