-
Notifications
You must be signed in to change notification settings - Fork 8
/
Jenkinsfile-update-golds
88 lines (74 loc) · 3.96 KB
/
Jenkinsfile-update-golds
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
#!/usr/bin/env groovy
@Library('StanUtils')
import org.stan.Utils
import groovy.json.JsonSlurper
import groovy.json.*
def utils = new org.stan.Utils()
String stanc3_bin_url() { params.stanc3_bin_url != "nightly" ? "\nSTANC3_TEST_BIN_URL=${params.stanc3_bin_url}\n" : "" }
pipeline {
agent { label 'docker' }
environment {
GITHUB_TOKEN = credentials('6e7c1e8f-ca2c-4b11-a70e-d934d3f6b681')
}
options {
skipDefaultCheckout()
preserveStashes(buildCount: 7)
}
parameters {
string(defaultValue: 'nightly', name: 'stanc3_bin_url', description: 'Custom stanc3 binary url')
}
stages {
stage("Numerical Accuracy and Performance Tests on Known-Good Models") {
agent { label 'osx && intel' }
steps {
/* Checkout source code */
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
submoduleCfg: [],
userRemoteConfigs: [[url: "https://github.com/stan-dev/performance-tests-cmdstan.git",
credentialsId: 'a630aebc-6861-4e69-b497-fd7f496ec46b'
]]])
/* Write CXX flags for cmdstan*/
writeFile(file: "cmdstan/make/local", text: "PRECOMPILED_HEADERS=False CXXFLAGS += -march=core2 \n${stanc3_bin_url()}")
/* Run tests */
sh "python3 runPerformanceTests.py -j8 --runj 8 --overwrite --runs 3 --check-golds --name=known_good_perf --tests-file=known_good_perf_all.tests"
/* Create a merge request */
withCredentials([usernamePassword(credentialsId: 'a630aebc-6861-4e69-b497-fd7f496ec46b',
usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD')]) {
sh """
git config user.email "[email protected]"
git config user.name "Stan Jenkins"
git config auth.token "${GITHUB_TOKEN}"
CURR_DATE=\$(date '+%d-%m-%Y-%H-%M-%S')
BRANCH_NAME="update-golds-test/\$CURR_DATE"
git checkout -b "\$BRANCH_NAME"
rm -rf known_good_perf.xml
rm -rf known_good_perf.csv
git add .
git commit -m "Update-golds test results for \$CURR_DATE"
git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/stan-dev/performance-tests-cmdstan.git "\$BRANCH_NAME"
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST -d '{"title": "Update golds test results generated by Jenkins for '\$CURR_DATE'", "head":"'\$BRANCH_NAME'", "base":"master", "body":"Results generated through a [Jenkins Job](https://jenkins.flatironinstitute.org/blue/organizations/jenkins/Stan%2FUpdate-golds)"}' "https://api.github.com/repos/stan-dev/performance-tests-cmdstan/pulls"
"""
}
}
}
}
post {
success {
script { utils.mailBuildResults("SUCCESS", "[email protected], [email protected]") }
}
unstable {
script { utils.mailBuildResults("UNSTABLE", "[email protected], [email protected]") }
}
failure {
script { utils.mailBuildResults("FAILURE", "[email protected], [email protected]") }
}
}
}