-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
139 lines (126 loc) · 4.08 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
#################################################################
# #
# Copyright (c) 2018-2024 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 GOPROXY=https://proxy.golang.org/cached-only
- export GOPATH=/go
- export GOBIN=${GOPATH}/bin
- 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
- export ydb_dist=/opt/yottadb/current
- mkdir -p $CI_PROJECT_DIR/artifacts
.unit_tests:
stage: test
script:
- export YDB_GO_SKIP_TIMED_TESTS="yes"
- go get -t
- go test -v
- cp -r /tmp/ydbgo* $CI_PROJECT_DIR/artifacts
- cp -r m_routines $CI_PROJECT_DIR/artifacts
- find $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 -v -race
coverage:
stage: test
script:
- mkdir -p $CI_PROJECT_DIR/cover
- go get -t
- go test -covermode=count -coverprofile "$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
# https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html
- go get github.com/boumenot/gocover-cobertura
- go install github.com/boumenot/gocover-cobertura
- gocover-cobertura < $CI_PROJECT_DIR/cover/coverage.cov > $CI_PROJECT_DIR/cover/coverage.xml
# https://docs.gitlab.com/ee/ci/yaml/index.html#coverage
coverage: '/coverage: \d+(?:\.\d+)?/'
artifacts:
paths:
- cover/coverage.cov
- cover/coverage.html
reports:
coverage_report:
coverage_format: cobertura
path: cover/coverage.xml
commit-verify:
image: ubuntu:22.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
script:
- go install golang.org/x/lint/golint@latest
- golint -set_exit_status
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 -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