This repository was archived by the owner on Mar 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathJenkinsfile
More file actions
97 lines (96 loc) · 3.46 KB
/
Jenkinsfile
File metadata and controls
97 lines (96 loc) · 3.46 KB
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
pipeline {
agent { label 'general' }
environment {
CGO_ENABLED = 0
GO111MODULE = 'on'
SLACK_MESSAGE = "Protos CI » <${RUN_DISPLAY_URL}|Jenkins ${BRANCH_NAME} Job>${ env.CHANGE_URL ? " » <${CHANGE_URL}|GitHub PR #${CHANGE_ID}>" : '' }"
GOPATH = "${env.WORKSPACE}/GOPATH"
GOBIN = "${env.GOPATH}/bin"
PROTOC_HOME = "${env.WORKSPACE}/PROTOC_HOME"
PATH = "${env.PROTOC_HOME}/bin:${env.GOBIN}:${env.PATH}"
PROTOC_VERSION = "3.19.4"
}
stages {
stage('Config') {
steps {
sh 'printenv'
echo "params=${params}"
}
}
stage('unit tests') {
options { retry(3) }
steps {
sh 'go test -v ./... 2>&1 | tee unit-test-results.txt && cat unit-test-results.txt | go-junit-report > vega-unit-test-report.xml'
junit checksName: 'Unit Tests', testResults: 'vega-unit-test-report.xml'
}
}
stage('Install dependencies') {
options { retry(3) }
steps {
sh label: 'protoc', script: """#!/bin/bash -e
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO \$PB_REL/download/v${env.PROTOC_VERSION}/protoc-${env.PROTOC_VERSION}-linux-x86_64.zip
unzip protoc-${env.PROTOC_VERSION}-linux-x86_64.zip -d "${PROTOC_HOME}"
"""
sh './script/gettools.sh'
sh 'protoc --version'
sh 'which protoc'
sh 'buf --version'
sh 'which buf'
}
}
stage('Run linters') {
parallel {
stage('buf lint') {
options { retry(3) }
steps {
sh 'buf lint'
}
post {
failure {
sh 'printenv'
echo "params=${params}"
sh 'protoc --version'
sh 'which protoc'
sh 'buf --version'
sh 'which buf'
sh 'git diff'
}
}
}
stage('proto check') {
options { retry(3) }
steps {
sh 'make proto_check'
}
post {
failure {
sh 'printenv'
echo "params=${params}"
sh 'protoc --version'
sh 'which protoc'
sh 'buf --version'
sh 'which buf'
sh 'git diff'
}
}
}
}
}
}
post {
success {
retry(3) {
slackSend(channel: "#tradingcore-notify", color: "good", message: ":white_check_mark: ${SLACK_MESSAGE} (${currentBuild.durationString.minus(' and counting')})")
}
}
failure {
retry(3) {
slackSend(channel: "#tradingcore-notify", color: "danger", message: ":red_circle: ${SLACK_MESSAGE} (${currentBuild.durationString.minus(' and counting')})")
}
}
always {
cleanWs()
}
}
}