forked from olaeld/DFUnit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
55 lines (54 loc) · 2.36 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
pipeline {
agent { label "Windows" }
environment {
// General
COMPILER = 'C:\\Program Files\\DataFlex 20.1\\Bin64\\DfCompConsole.exe'
}
stages {
stage("Pipeline") {
parallel {
stage("Unit Tests") {
environment {
WORKSPACE_NAME = "DFUnit-Sample"
UNITTEST_NAME = "RunAllTests"
WORKSPACE_DIR = "DFUnit Example Workspace"
WORKSPACE_OUTPUT = "${WORKSPACE_DIR}\\Programs"
UNITTEST_SWS = "${WORKSPACE_DIR}\\${WORKSPACE_NAME}.sws"
UNITTEST_SRC = "AppSrc\\${UNITTEST_NAME}.src"
UNITTEST_JUNIT_OUTPUT = "test_results.xml"
}
stages {
stage("Build") {
steps {
script {
bat "\"${COMPILER}\" -x\"${UNITTEST_SWS}\" -c \"${UNITTEST_SRC}\""
stash name: 'build', includes: "**"
}
}
}
stage('Test') {
steps {
unstash 'build'
powershell(script: """
\$executable = "${WORKSPACE_OUTPUT}\\${UNITTEST_NAME}.exe"
\$arguments = "--console -o ${UNITTEST_JUNIT_OUTPUT}"
\$process = Start-Process -Wait -PassThru \$executable \$arguments
if (\$process.ExitCode -ne 0) {
echo "Unit Tests failed with exit code: \$(\$process.ExitCode)."
exit -1
}
""")
}
post {
always {
junit "${UNITTEST_JUNIT_OUTPUT}"
archiveArtifacts artifacts: "${UNITTEST_JUNIT_OUTPUT}", fingerprint: true
}
}
}
}
}
}
}
}
}