From 20fcbce330b3552cf1dae2d1359115cd61b5020d Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 31 Mar 2018 09:52:12 -0500 Subject: [PATCH] run go tests --- .gitlab-ci.yml | 25 ++++++++++++++++++++++--- main_test.go | 10 ++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 main_test.go diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2d5eb6a..a57f72b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,12 +4,15 @@ stages: - test - package -build:go: - stage: build +.go: &go-job image: andrexus/golang-dep tags: - runner:k8s +build:go: + <<: *go-job + stage: build + script: - time dep ensure - go build @@ -22,7 +25,23 @@ build:go: expire_in: 1 hour cache: key: "${CI_COMMIT_REF_SLUG}" - untracked: true + policy: pull-push + paths: + - vendor + +test:go: + <<: *go-job + stage: test + + cache: + key: "${CI_COMMIT_REF_SLUG}" + policy: pull + dependencies: + - build:go + script: + - go test + variables: + GOPATH: /build package:docker: stage: package diff --git a/main_test.go b/main_test.go new file mode 100644 index 0000000..6249ee1 --- /dev/null +++ b/main_test.go @@ -0,0 +1,10 @@ +package main + +import ( + "fmt" + "testing" +) + +func TestSomething(t *testing.T) { + fmt.Println("hello") +}