forked from getanteon/anteon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile_benchmark
58 lines (54 loc) · 2.36 KB
/
Jenkinsfile_benchmark
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
pipeline {
agent {
dockerfile {
label 'performance-test'
filename '.devcontainer/Dockerfile.dev'
}
}
options {
disableConcurrentBuilds()
}
stages {
stage('Performance Test') {
steps {
lock('multi_branch_server_benchmark') {
sh 'set -o pipefail && GOCACHE=/tmp/ go test -benchmem -timeout 60m -benchtime=1x -cpuprof=cpu.out -memprof=mem.out -tracef=trace.out -run=^$ -bench ^BenchmarkEngines/$ -count 1 -runN=10 | tee gobench_branch.txt'
}
}
}
stage('Performance Test Develop') {
when {
// Run on only PR
allOf {
expression { env.CHANGE_ID != null }
expression { env.CHANGE_TARGET != null }
expression { env.CHANGE_BRANCH != 'develop' }
}
}
steps {
lock('multi_branch_server_benchmark') {
sh 'git fetch origin develop:develop || git checkout develop && git pull && set -o pipefail && GOCACHE=/tmp/ go test -benchmem -timeout 60m -benchtime=1x -cpuprof=cpu_develop.out -memprof=mem_develop.out -tracef=trace_develop.out -run=^$ -bench ^BenchmarkEngines/$ -count 1 -runN=10 | tee gobench_develop.txt'
sh "git checkout ${BRANCH_NAME}"
sh "benchstat -alpha 1.01 --sort delta gobench_develop.txt gobench_branch.txt | tee gobench_branch_result.txt"
sh "benchstat -alpha 1.01 --sort delta --html gobench_develop.txt gobench_branch.txt > 00_gobench_result.html && echo ${BUILD_URL}artifact/00_gobench_result.html"
withCredentials([usernamePassword(credentialsId: 'ddosifyadmin_comment_github_access', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USERNAME')]) {
sh "./scripts/testing/benchstat.sh ${GITHUB_TOKEN} ${env.CHANGE_ID}"
}
}
}
}
}
post {
always {
archiveArtifacts artifacts: '*.out', fingerprint: true
archiveArtifacts artifacts: 'gobench_*.txt', fingerprint: true
archiveArtifacts artifacts: '00_gobench_result.html', fingerprint: true, allowEmptyArchive: true
}
unstable {
slackSend(channel: '#jenkins', color: 'danger', message: "${currentBuild.currentResult}: ${currentBuild.fullDisplayName} - ${BUILD_URL}")
}
failure {
slackSend(channel: '#jenkins', color: 'danger', message: "${currentBuild.currentResult}: ${currentBuild.fullDisplayName} - ${BUILD_URL}")
}
}
}