-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
146 lines (133 loc) · 4.61 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#################################################################
# #
# Copyright (c) 2018-2023 YottaDB LLC and/or its subsidiaries. #
# All rights reserved. #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
# under a license. If you do not know the terms of #
# the license, please stop and do not read further. #
# #
#################################################################
image: yottadb/yottadb-base:latest-master
stages:
- test
- build
- deploy
variables:
# Note: If GOLANG_VERSION below is bumped up in the future, changes would be needed to at least the following files
# YDBGo repo : Dockerfile
# There might be more files to change in the future.
# Search for "GOLANG_VERSION" name in all YDB repos to find places that need change.
GOLANG_VERSION: 1.18.1
before_script:
- apt-get update && apt-get install -y --no-install-recommends wget ca-certificates git g++ gcc libc6-dev make pkg-config && rm -rf /var/lib/apt/lists/*
- export GOPATH=/go
- export GOBIN=${GOPATH}/bin
- export GO111MODULE=off
- mkdir -p ${GOPATH}/src ${GOBIN} && chmod -R 777 ${GOPATH}
- mkdir -p ${GOPATH}/src/lang.yottadb.com/go/yottadb/.git ${GOPATH}/src/_/builds
- cp -r $CI_PROJECT_DIR/* ${GOPATH}/src/lang.yottadb.com/go/yottadb
- cp -r $CI_PROJECT_DIR/.git/* ${GOPATH}/src/lang.yottadb.com/go/yottadb/.git
- ln -s ${GOPATH}/src/lang.yottadb.com/go/yottadb ${GOPATH}/src/_/builds/yottadb
- export PATH=${GOBIN}:/usr/local/go/bin:$PATH
- wget -O go.tgz -q https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz
- tar -C /usr/local -xzf go.tgz
- rm go.tgz
- go version
- cd ${GOPATH}/src/lang.yottadb.com/go/yottadb
- export ydb_dist=/opt/yottadb/current
- export ydb_gbldir=mumps.gld
- export ydb_routines=/opt/yottadb/current/libyottadbutil.so
- echo exit | /opt/yottadb/current/mumps -run ^GDE
- /opt/yottadb/current/mupip create
- mkdir -p $CI_PROJECT_DIR/artifacts
.unit_tests:
stage: test
script:
- export ydb_routines=". m_routines/ $ydb_routines"
- export YDB_GO_SKIP_TIMED_TESTS="yes"
- go get -t
- go test -short $(go list ./... | grep -v /vendor/)
- cp -r . $CI_PROJECT_DIR/artifacts
artifacts:
paths:
- artifacts
expire_in: 7 days
#
# In general, test the latest point release of each major version
#
unit_tests1.18.10:
extends: .unit_tests
variables:
GOLANG_VERSION: "1.18.10"
unit_tests1.19.9:
extends: .unit_tests
variables:
GOLANG_VERSION: "1.19.9"
unit_tests1.20.4:
extends: .unit_tests
variables:
GOLANG_VERSION: "1.20.4"
race_detector:
stage: test
script:
- go get -t
- go test -race -short $(go list ./... | grep -v /vendor/)
coverage:
stage: test
script:
- PKG_LIST=$(go list ./... | grep -v /vendor/)
- mkdir -p $CI_PROJECT_DIR/cover
- for package in ${PKG_LIST}; do
- go get -t
- go test -covermode=count -coverprofile "$CI_PROJECT_DIR/cover/${package##*/}.cov" "$package" ;
- done
- echo mode":" count > $CI_PROJECT_DIR/cover/coverage.cov
- tail -q -n +2 $CI_PROJECT_DIR/cover/*.cov >> $CI_PROJECT_DIR/cover/coverage.cov
- go tool cover -func=$CI_PROJECT_DIR/cover/coverage.cov
- go tool cover -html=$CI_PROJECT_DIR/cover/coverage.cov -o $CI_PROJECT_DIR/cover/coverage.html
artifacts:
paths:
- cover/coverage.cov
- cover/coverage.html
commit-verify:
image: ubuntu:18.04
stage: test
before_script:
- apt-get update -qq && apt-get install -y -qq git wget gnupg
script:
# Copy commit gpg key verify script to build directory and execute
- wget https://gitlab.com/YottaDB/DB/YDB/-/raw/master/ci/commit_verify.sh
- chmod +x commit_verify.sh
- ./commit_verify.sh scripts/needs_copyright.sh https://gitlab.com/YottaDB/Lang/YDBGo develop
lint_code:
stage: test
variables:
GOLANG_VERSION: "1.18.10"
script:
- go get -u golang.org/x/lint/golint
- find / -name "*lint*"
- ${GOBIN}/golint -set_exit_status $(go list ./... | grep -v /vendor/ | grep -v /internal/)
error_codes:
stage: test
script:
- go generate
- git diff --exit-code error_codes.go || (echo "There is a difference between the latest YottaDB master and the currently committed error_codes.go, please run 'go generate' and commit error_codes.go" && exit 1)
build:
stage: build
script:
- go build -i -v lang.yottadb.com/go/yottadb
pages:
stage: deploy
dependencies:
- coverage
script:
- mkdir $CI_PROJECT_DIR/public
- mv cover/coverage.html $CI_PROJECT_DIR/public/
artifacts:
paths:
- public
expire_in: 30 days
only:
- master