forked from objectbox/objectbox-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile-Windows
More file actions
96 lines (81 loc) · 2.99 KB
/
Copy pathJenkinsfile-Windows
File metadata and controls
96 lines (81 loc) · 2.99 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
#!/usr/bin/env groovy
String buildsToKeep = '500'
String gradleArgs = '--stacktrace'
boolean isPublish = BRANCH_NAME == 'publish'
// Note: using single quotes to avoid Groovy String interpolation leaking secrets.
def gitlabRepoArgsBat = '-PgitlabUrl=%GITLAB_URL% -PgitlabPrivateToken=%GITLAB_TOKEN%'
// https://jenkins.io/doc/book/pipeline/syntax/
pipeline {
agent { label 'windows' }
environment {
GITLAB_URL = credentials('gitlab_url')
GITLAB_TOKEN = credentials('GITLAB_TOKEN_ALL')
}
options {
buildDiscarder(logRotator(numToKeepStr: buildsToKeep, artifactNumToKeepStr: buildsToKeep))
gitLabConnection('objectbox-gitlab-connection')
}
triggers {
upstream(upstreamProjects: "objectbox-windows/${env.BRANCH_NAME.replaceAll("/", "%2F")}",
threshold: hudson.model.Result.SUCCESS)
}
stages {
stage('init') {
steps {
bat 'gradlew -version'
}
}
stage('build-java-x64') {
steps {
// Remove files to avoid archiving them again.
bat 'del /q /s hs_err_pid*.log'
bat "gradlew $gradleArgs $gitlabRepoArgsBat cleanTest build"
}
post {
always {
junit '**/build/test-results/**/TEST-*.xml'
archiveArtifacts artifacts: '**/hs_err_pid*.log', allowEmptyArchive: true
}
}
}
stage('build-java-x86') {
environment {
// TEST_WITH_JAVA_X86 makes objectbox-java-test use 32-bit java executable and therefore
// 32-bit ObjectBox to run tests (see build.gradle file).
// Note: assumes JAVA_HOME_X86 is set to 32-bit JDK path.
TEST_WITH_JAVA_X86 = "true"
}
steps {
// Remove files to avoid archiving them again.
bat 'del /q /s hs_err_pid*.log'
bat "gradlew $gradleArgs $gitlabRepoArgsBat cleanTest build"
}
post {
always {
junit '**/build/test-results/**/TEST-*.xml'
archiveArtifacts artifacts: '**/hs_err_pid*.log', allowEmptyArchive: true
}
}
}
stage('package-javadoc-for-web') {
when { expression { return isPublish } }
steps {
bat "gradlew $gradleArgs $gitlabRepoArgsBat :objectbox-java:packageJavadocForWeb"
}
post {
always {
archiveArtifacts artifacts: 'objectbox-java/build/dist/objectbox-java-web-api-docs.zip'
}
}
}
}
// For global vars see /jenkins/pipeline-syntax/globals
post {
failure {
updateGitlabCommitStatus name: 'build-windows', state: 'failed'
}
success {
updateGitlabCommitStatus name: 'build-windows', state: 'success'
}
}
}