-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
222 lines (220 loc) · 7.41 KB
/
Jenkinsfile
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
def repo_ssh_url
def default_branch ='main'
pipeline {
environment {
user = credentials('Comps_emodpy_user')
COMPS_PASS = credentials('Comps_emodpy_password')
PYPI_STAGING_USERNAME = credentials('idm_bamboo_user')
PYPI_STAGING_PASSWORD = credentials('idm_bamboo_user_password')
}
agent {
node {
label "idmtools_slurm"
}
}
stages {
stage("Clean previous dir and virtual environment") {
steps {
dir("${WORKSPACE}") {
deleteDir()
}
sh 'ls -lart'
echo 'Remove disk_cache to avoid pickle issue'
sh 'rm -fr ~/.idmtools/cache/disk_cache/platforms/'
}
}
stage("Build URL and path") {
steps {
script {
repo_ssh_url = "[email protected]:InstituteforDiseaseModeling/idmtools.git"
default_branch = "main"
echo "workspace is ${WORKSPACE}"
}
}
}
stage('Code Checkout') {
steps {
script {
if (env.CHANGE_ID) {
echo "I execute on the pull request ${env.CHANGE_ID}"
checkout([$class: 'GitSCM',
branches: [[name: "pr/${env.CHANGE_ID}/head"]],
doGenerateSubmoduleConfigurations: false,
extensions: [],
gitTool: 'Default',
submoduleCfg: [],
userRemoteConfigs: [[refspec: '+refs/pull/*:refs/remotes/origin/pr/*', credentialsId: '704061ca-54ca-4aec-b5ce-ddc7e9eab0f2', url: repo_ssh_url]]])
} else {
echo "I execute on the ${env.BRANCH_NAME} branch"
git branch: "${env.BRANCH_NAME}",
credentialsId: '704061ca-54ca-4aec-b5ce-ddc7e9eab0f2',
url: repo_ssh_url
}
sh 'ls -lart'
}
}
}
stage('Create virtual environment'){
steps {
script {
withPythonEnv("/usr/bin/python3.10") {
sh 'pip list'
}
}
}
}
stage("Prepare") {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
withPythonEnv("/usr/bin/python3.10") {
sh 'pip install idm-buildtools flake8 wheel pygit2 matplotlib sqlalchemy natsort pytest --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple'
sh 'make setup-dev'
sh 'pip list'
sh 'python dev_scripts/create_auth_token_args.py --comps_url https://comps2.idmod.org --username idmtools_bamboo'
}
}
}
}
}
stage('Run idmtools slurm example') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
withPythonEnv("/usr/bin/python3.10") {
sh 'python examples/native_slurm/python_sims.py'
sh 'ls -lart ~/example/'
}
}
}
}
}
stage('run cli tests') {
//success = false
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
withPythonEnv("/usr/bin/python3.10") {
sh '''#!/bin/bash
cd idmtools_cli
PARALLEL_TEST_COUNT=2 make test-all
'''
}
}
}
}
}
stage('run core tests') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
withPythonEnv("/usr/bin/python3.10") {
sh '''#!/bin/bash
cd idmtools_core
PARALLEL_TEST_COUNT=2 make test-all
'''
}
}
}
}
}
stage('run platform_slurm tests') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
withPythonEnv("/usr/bin/python3.10") {
sh '''#!/bin/bash
cd idmtools_platform_slurm
make test-all
'''
}
}
}
}
}
stage('run models tests') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
withPythonEnv("/usr/bin/python3.10") {
sh '''#!/bin/bash
cd idmtools_models
PARALLEL_TEST_COUNT=2 make test-all
'''
}
}
}
}
}
stage('run slurm utils tests') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
withPythonEnv("/usr/bin/python3.10") {
sh '''#!/bin/bash
cd idmtools_slurm_utils
make test-all
'''
}
}
}
}
}
stage('run platform_general tests') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
withPythonEnv("/usr/bin/python3.10") {
sh '''#!/bin/bash
cd idmtools_platform_general
make test-all
'''
}
}
}
}
}
stage('run platform_container tests') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
withPythonEnv("/usr/bin/python3.10") {
sh '''#!/bin/bash
cd idmtools_platform_container
make test-all
'''
}
}
}
}
}
stage('Run idmtools platform comps tests') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
withPythonEnv("/usr/bin/python3.10") {
sh '''#!/bin/bash
cd idmtools_platform_comps
PARALLEL_TEST_COUNT=2 make test-all
'''
}
}
}
}
}
}
post {
// Clean after build
always {
junit(
allowEmptyResults: true,
testResults: '**/*test_results.xml',
skipPublishingChecks: true
)
cleanWs()
dir("/home/jenkins/example") {
deleteDir() //this is slurm example result
}
}
}
}