Skip to content

Instantly share code, notes, and snippets.

@alexyslozada
Forked from moemoe89/.gitlab-ci.yml
Created October 2, 2018 23:29
Show Gist options
  • Save alexyslozada/1e2a9d5416918400204dd8268c62ad76 to your computer and use it in GitHub Desktop.
Save alexyslozada/1e2a9d5416918400204dd8268c62ad76 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