Add .gitlab-ci.yml master
authorJoseph Nuthalapati <njoseph@thoughtworks.com>
Thu, 31 Dec 2020 03:39:42 +0000 (09:09 +0530)
committerJoseph Nuthalapati <njoseph@thoughtworks.com>
Thu, 31 Dec 2020 03:39:42 +0000 (09:09 +0530)
.gitlab-ci.yml [new file with mode: 0644]

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..45c1239
--- /dev/null
@@ -0,0 +1,28 @@
+image: golang:latest
+
+variables:
+  REPO_NAME: gitlab.com/njoseph/goutils
+
+before_script:
+  - mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
+  - ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
+  - cd $GOPATH/src/$REPO_NAME
+
+stages:
+  - test
+  - build
+
+format:
+  stage: test
+  script:
+    - go fmt $(go list ./... | grep -v /vendor/)
+    - go vet $(go list ./... | grep -v /vendor/)
+    - go test -race $(go list ./... | grep -v /vendor/)
+
+compile:
+  stage: build
+  script:
+    - go build -race -ldflags "-extldflags '-static'" -o $CI_PROJECT_DIR/goutils
+  artifacts:
+    paths:
+      - goutils
\ No newline at end of file