-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
52 lines (46 loc) · 1.51 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Copyright 2021 Sorcero, Inc.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
image: golang:latest
variables:
REPO_NAME: gitlab.com/sorcero/community/go-cat
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
- deploy
format:
stage: test
script:
- go fmt $(go list ./... | grep -v /vendor/)
- go vet $(go list ./... | grep -v /vendor/)
qa:
stage: test
script:
- cd cmd/go-cat
- go build .
- git config --global user.email "[email protected]"
- git config --global user.name "Your Name"
- mkdir -p /tmp/repo
- mkdir -p /tmp/repo-bare
- git -C /tmp/repo-bare init --bare
- git -C /tmp/repo init
- touch /tmp/repo/README.md
- git -C /tmp/repo add /tmp/repo/README.md
- git -C /tmp/repo commit -m "initial commit"
- git -C /tmp/repo remote add origin file:///tmp/repo-bare
- git -C /tmp/repo push -u origin master
- GO_CAT_GIT_URL="/tmp/repo-bare" ./go-cat upsert --name="componentA" --commit-sha="aaaaa" --cloud="A" --cloud-project-id="alphabets" --subsystem="sli" --type="null" --deployment-links="https://example.org"
compile:
stage: build
script:
- cd cmd/go-cat
- go build -race -ldflags "-extldflags '-static'" -o $CI_PROJECT_DIR/go-cat
artifacts:
paths:
- go-cat