GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — objectbox-java/Jenkinsfile at main · defuj/objectbox-java Expand file tree/ Copy pathJenkinsfileMore file actions 173 lines (153 loc) · 7.7 KB / Copy pathJenkinsfileFile metadata and controls173 lines (153 loc) · 7.7 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 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 // dev branch only: run every hour at 30th minute at night (1:00 - 5:00) // Avoid running at the same time as integration tests: uses this projects snapshots // so make sure to not run in the middle of uploading a new snapshot to avoid dependency resolution errors. String cronSchedule = BRANCH_NAME == 'dev' ? '30 1-5 * * *' : '' String buildsToKeep = '500' String gradleArgs = '--stacktrace' boolean isPublish = BRANCH_NAME == 'publish' String versionPostfix = isPublish ? '' : BRANCH_NAME // Build script detects empty string as not set. // Note: using single quotes to avoid Groovy String interpolation leaking secrets. def signingArgs = '-PsigningKeyFile=$SIGNING_FILE -PsigningKeyId=$SIGNING_ID -PsigningPassword=$SIGNING_PWD' def gitlabRepoArgs = '-PgitlabUrl=$GITLAB_URL -PgitlabPrivateToken=$GITLAB_TOKEN' def uploadRepoArgsCentral = '-PsonatypeUsername=$OSSRH_LOGIN_USR -PsonatypePassword=$OSSRH_LOGIN_PSW' boolean startedByTimer = currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause').size() > 0 def buildCauses = currentBuild.getBuildCauses() echo "startedByTimer=$startedByTimer, build causes: $buildCauses" // https://jenkins.io/doc/book/pipeline/syntax/ pipeline { agent { label 'java' } environment { GITLAB_URL = credentials('gitlab_url') GITLAB_TOKEN = credentials('GITLAB_TOKEN_ALL') GITLAB_INTEG_TESTS_TRIGGER_URL = credentials('gitlab-trigger-java-integ-tests') // Note: for key use Jenkins secret file with PGP key as text in ASCII-armored format. SIGNING_FILE = credentials('objectbox_signing_key') SIGNING_ID = credentials('objectbox_signing_key_id') SIGNING_PWD = credentials('objectbox_signing_key_password') } options { buildDiscarder(logRotator(numToKeepStr: buildsToKeep, artifactNumToKeepStr: buildsToKeep)) timeout(time: 1, unit: 'HOURS') // If build hangs (regular build should be much quicker) disableConcurrentBuilds() // limit to 1 job per branch gitLabConnection('objectbox-gitlab-connection') } triggers { upstream(upstreamProjects: "ObjectBox-Linux/${env.BRANCH_NAME.replaceAll("/", "%2F")}", threshold: hudson.model.Result.SUCCESS) cron(cronSchedule) } stages { stage('init') { steps { sh './gradlew -version' // "|| true" for an OK exit code if no file is found sh 'rm tests/objectbox-java-test/hs_err_pid*.log || true' } } stage('build-java') { steps { sh "./ci/test-with-asan.sh $gradleArgs $signingArgs $gitlabRepoArgs clean build" } post { always { junit '**/build/test-results/**/TEST-*.xml' archiveArtifacts artifacts: 'tests/*/hs_err_pid*.log', allowEmptyArchive: true // Only on JVM crash. recordIssues(tool: spotBugs(pattern: '**/build/reports/spotbugs/*.xml', useRankAsPriority: true)) } } } // Test oldest supported and a recent JDK. // Note: can not run these in parallel using a matrix configuration as Gradle would step over itself. // Also shouldn't add agent config to avoid that as it triggers a separate job which can easily cause deadlocks. stage("test-jdk-8") { environment { TEST_JDK = "8" } steps { // "|| true" for an OK exit code if no file is found sh 'rm tests/objectbox-java-test/hs_err_pid*.log || true' // Note: do not run check task as it includes SpotBugs. sh "./ci/test-with-asan.sh $gradleArgs $gitlabRepoArgs clean :tests:objectbox-java-test:test" } post { always { junit '**/build/test-results/**/TEST-*.xml' archiveArtifacts artifacts: 'tests/*/hs_err_pid*.log', allowEmptyArchive: true // Only on JVM crash. } } } stage("test-jdk-16") { environment { TEST_JDK = "16" } steps { // "|| true" for an OK exit code if no file is found sh 'rm tests/objectbox-java-test/hs_err_pid*.log || true' // Note: do not run check task as it includes SpotBugs. sh "./ci/test-with-asan.sh $gradleArgs $gitlabRepoArgs clean :tests:objectbox-java-test:test" } post { always { junit '**/build/test-results/**/TEST-*.xml' archiveArtifacts artifacts: 'tests/*/hs_err_pid*.log', allowEmptyArchive: true // Only on JVM crash. } } } stage('upload-to-internal') { steps { sh "./gradlew $gradleArgs $signingArgs $gitlabRepoArgs -PversionPostFix=$versionPostfix publishMavenJavaPublicationToGitLabRepository" } } stage('upload-to-central') { when { expression { return isPublish } } environment { OSSRH_LOGIN = credentials('ossrh-login') } steps { googlechatnotification url: 'id:gchat_java', message: "*Publishing* ${currentBuild.fullDisplayName} to Central...\n${env.BUILD_URL}" // Note: supply internal repo as tests use native dependencies that might not be published, yet. sh "./gradlew $gradleArgs $signingArgs $gitlabRepoArgs $uploadRepoArgsCentral publishMavenJavaPublicationToSonatypeRepository closeAndReleaseStagingRepository" googlechatnotification url: 'id:gchat_java', message: "Published ${currentBuild.fullDisplayName} successfully to Central - check https://repo1.maven.org/maven2/io/objectbox/ in a few minutes.\n${env.BUILD_URL}" } } } // For global vars see /jenkins/pipeline-syntax/globals post { always { googlechatnotification url: 'id:gchat_java', message: "${currentBuild.currentResult}: ${currentBuild.fullDisplayName}\n${env.BUILD_URL}", notifyFailure: 'true', notifyUnstable: 'true', notifyBackToNormal: 'true' } failure { updateGitlabCommitStatus name: 'build', state: 'failed' emailext ( subject: "${currentBuild.currentResult}: ${currentBuild.fullDisplayName}", mimeType: 'text/html', recipientProviders: [[$class: 'DevelopersRecipientProvider']], body: """ <p>${currentBuild.currentResult}: <a href='${env.BUILD_URL}'>${currentBuild.fullDisplayName}</a> (<a href='${env.BUILD_URL}/console'>console</a>) </p> <p>Git: ${GIT_COMMIT} (${GIT_BRANCH}) <p>Build time: ${currentBuild.durationString} """ ) } success { updateGitlabCommitStatus name: 'build', state: 'success' script { if (startedByTimer) { echo "Started by timer, not triggering integration tests" } else { // Trigger integration tests in GitLab // URL configured like <host>/api/v4/projects/<id>/trigger/pipeline?token=<token> // Note: do not fail on error in case ref does not exist, only output response // --silent --show-error disable progress output but still show errors sh 'curl --silent --show-error -X POST "$GITLAB_INTEG_TESTS_TRIGGER_URL&ref=$GIT_BRANCH"' } } } } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |