Skip to content

Commit

Permalink
Merge pull request #3002 from Catrobat/release-0.9.42
Browse files Browse the repository at this point in the history
Release-0.9.42
  • Loading branch information
wslany authored Oct 18, 2018
2 parents 34b08ce + eddae26 commit 90ca0ad
Show file tree
Hide file tree
Showing 868 changed files with 20,952 additions and 24,268 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,13 @@ __pycache__

#api-keys
catroid/google-services.json

#Crowdin folder
crowdin/

#Fastlane
fastlane/*
!fastlane/Appfile
!fastlane/Fastfile
!fastlane/staticContent/
Gemfile
76 changes: 58 additions & 18 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ pipeline {
// the container for the ssh-agent to work.
// Another way would be to simply map the passwd file, but would spoil additional information
additionalBuildArgs '--build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g)'
args "--device /dev/kvm:/dev/kvm -v /var/local/container_shared/gradle/:/.gradle -v /var/local/container_shared/android-sdk:/usr/local/android-sdk -v /var/local/container_shared/android-home:/.android -v /var/local/container_shared/emulator_console_auth_token:/.emulator_console_auth_token -v /var/local/container_shared/analytics.settings:/analytics.settings"
// Currently there are two different NDK behaviors in place, one to keep NDK r16b, which
// was needed because of the removal of armeabi and MIPS support and one to always use the
// latest NDK, which is the suggestion from the NDK documentations.
// Therefore two different SDK locations on the host are currently in place:
// NDK r16b : /var/local/container_shared/android-sdk
// NDK latest: /var/local/container_shared/android-sdk-ndk-latest
// As android-sdk was used from the beginning and is already 'released' this can't be changed
// to eg android-sdk-ndk-r16b and must be kept to the previously used value
args "--device /dev/kvm:/dev/kvm -v /var/local/container_shared/gradle/:/.gradle -v /var/local/container_shared/android-sdk-ndk-latest:/usr/local/android-sdk -v /var/local/container_shared/android-home:/.android -v /var/local/container_shared/emulator_console_auth_token:/.emulator_console_auth_token -v /var/local/container_shared/analytics.settings:/analytics.settings"
}
}

Expand Down Expand Up @@ -48,14 +56,21 @@ pipeline {
APK_LOCATION_DEBUG = "${env.GRADLE_PROJECT_MODULE_NAME}/build/outputs/apk/catroid/debug/catroid-catroid-debug.apk"
APK_LOCATION_STANDALONE = "${env.GRADLE_PROJECT_MODULE_NAME}/build/outputs/apk/standalone/debug/catroid-standalone-debug.apk"

// share.catrob.at
CATROBAT_SHARE_UPLOAD_BRANCH = "develop"
CATROBAT_SHARE_APK_NAME = "org.catrobat.catroid_debug_${env.CATROBAT_SHARE_UPLOAD_BRANCH}_latest.apk"
JACOCO_XML = "${env.GRADLE_PROJECT_MODULE_NAME}/build/reports/coverage/catroid/debug/report.xml"
JACOCO_UNIT_XML = "${env.GRADLE_PROJECT_MODULE_NAME}/build/reports/jacoco/jacocoTestCatroidDebugUnitTestReport/jacocoTestCatroidDebugUnitTestReport.xml"

// place the cobertura xml relative to the source, so that the source can be found
JAVA_SRC = "${env.GRADLE_PROJECT_MODULE_NAME}/src/main/java"
}

options {
timeout(time: 2, unit: 'HOURS')
timestamps()
buildDiscarder(logRotator(numToKeepStr: '30'))
}

triggers {
cron(env.BRANCH_NAME == 'develop' ? '@midnight' : '')
}

stages {
Expand Down Expand Up @@ -86,21 +101,60 @@ pipeline {
steps {
// Run local unit tests
sh "./buildScripts/build_step_run_unit_tests__all_tests"
// Convert the JaCoCo coverate to the Cobertura XML file format.
// This is done since the Jenkins JaCoCo plugin does not work well.
// See also JENKINS-212 on jira.catrob.at
sh "if [ -f '$JACOCO_UNIT_XML' ]; then ./buildScripts/cover2cover.py $JACOCO_UNIT_XML > $JAVA_SRC/coverage1.xml; fi"
// ensure that the following test run does not overwrite the results
sh "mv ${env.GRADLE_PROJECT_MODULE_NAME}/build ${env.GRADLE_PROJECT_MODULE_NAME}/build-unittest"

// Run device tests for package: org.catrobat.catroid.test
sh "./buildScripts/build_step_run_tests_on_emulator__test_pkg"
// Convert the JaCoCo coverate to the Cobertura XML file format.
// This is done since the Jenkins JaCoCo plugin does not work well.
// See also JENKINS-212 on jira.catrob.at
sh "if [ -f '$JACOCO_XML' ]; then ./buildScripts/cover2cover.py $JACOCO_XML > $JAVA_SRC/coverage2.xml; fi"
// ensure that the following test run does not overwrite the results
sh "mv ${env.GRADLE_PROJECT_MODULE_NAME}/build ${env.GRADLE_PROJECT_MODULE_NAME}/build-test-test-pkg"

// Run device tests for class: org.catrobat.catroid.uiespresso.testsuites.PullRequestTriggerSuite
sh "./buildScripts/build_step_run_tests_on_emulator__pr_test_suite"
// Convert the JaCoCo coverate to the Cobertura XML file format.
// This is done since the Jenkins JaCoCo plugin does not work well.
// See also JENKINS-212 on jira.catrob.at
sh "if [ -f '$JACOCO_XML' ]; then ./buildScripts/cover2cover.py $JACOCO_XML > $JAVA_SRC/coverage3.xml; fi"
// ensure that the following test run does not overwrite the results
sh "mv ${env.GRADLE_PROJECT_MODULE_NAME}/build ${env.GRADLE_PROJECT_MODULE_NAME}/build-test-emulator-pr-test-suite"
}

post {
always {
junit '**/*TEST*.xml'
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: "$JAVA_SRC/coverage*.xml", failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false, failNoReports: false])

// stop/kill emulator
sh "./buildScripts/build_helper_stop_emulator"
}
}
}

stage('Quarantined Tests') {
when {
expression { isJobStartedByTimer() }
}

steps {
sh './buildScripts/build_helper_start_emulator'
sh './gradlew -PenableCoverage clean adbDisableAnimationsGlobally createCatroidDebugAndroidTestCoverageReport -Pandroid.testInstrumentationRunnerArguments.class=org.catrobat.catroid.uiespresso.testsuites.QuarantineTestSuite'
archiveArtifacts "$JACOCO_XML"
sh "if [ -f '$JACOCO_XML' ]; then ./buildScripts/cover2cover.py $JACOCO_XML > $JAVA_SRC/coverage4.xml; fi"

}

post {
always {
junit 'catroid/build/**/*TEST*.xml'
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: "$JAVA_SRC/coverage4.xml", failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false, failNoReports: false])

// stop/kill emulator
sh "./buildScripts/build_helper_stop_emulator"
Expand All @@ -122,23 +176,9 @@ pipeline {
// The resulting APK is not verified on itself.
steps {
sh "./buildScripts/build_step_create_independent_apk"
stash name: "apk-independent", includes: "${env.APK_LOCATION_DEBUG}"
archiveArtifacts "${env.APK_LOCATION_DEBUG}"
}
}

stage('Upload to share') {
when {
branch "${env.CATROBAT_SHARE_UPLOAD_BRANCH}"
}

steps {
unstash "apk-independent"
script {
uploadFileToShare "${env.APK_LOCATION_DEBUG}", "${env.CATROBAT_SHARE_APK_NAME}"
}
}
}
}

post {
Expand Down
59 changes: 59 additions & 0 deletions Jenkinsfile.SensorboxTests
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!groovy
pipeline {
agent {
node {
label 'HardwareSensorBox'
}
}

environment {
//////////// Most likely not edited by the developer
ANDROID_SDK_ROOT = "${ANDROID_SDK_LOCATION}"
// Deprecated: Still used by the used gradle version, once gradle respects ANDROID_SDK_ROOT, this can be removed
ANDROID_HOME = "${ANDROID_SDK_LOCATION}"
ANDROID_SDK_LOCATION = "${ANDROID_SDK_LOCATION}"
// get stdout of called subprocesses immediately
PYTHONUNBUFFERED = "true"
}

options {
timeout(time: 2, unit: 'HOURS')
timestamps()
}

stages {
stage('Setup Android SDK') {
steps {
// Install Android SDK
lock("update-android-sdk-on-${env.NODE_NAME}") {
sh "./buildScripts/build_step_install_android_sdk"
}
}
}

stage('Unit and Device tests') {
steps {
lock("run-sensorbox-tests-on-${env.NODE_NAME}") {
sh './gradlew -Pandroid.testInstrumentationRunnerArguments.class=org.catrobat.catroid.uiespresso.testsuites.SensorboxTestSuite connectedCatroidDebugAndroidTest'
}
}

post {
always {
junit '**/*TEST*.xml'
}
}
}
}

post {
always {
step([$class: 'LogParserPublisher', failBuildOnError: true, projectRulePath: 'buildScripts/log_parser_rules', unstableOnWarning: true, useProjectRule: true])

script {
sendNotifications false
}
}
}
}

148 changes: 148 additions & 0 deletions Jenkinsfile.buildMetadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#!groovy

pipeline {
agent {
dockerfile {
filename 'Dockerfile.jenkins'
// 'docker build' would normally copy the whole build-dir to the container, changing the
// docker build directory avoids that overhead
dir 'docker'
// Pass the uid and the gid of the current user (jenkins-user) to the Dockerfile, so a
// corresponding user can be added. This is needed to provide the jenkins user inside
// the container for the ssh-agent to work.
// Another way would be to simply map the passwd file, but would spoil additional information
additionalBuildArgs '--build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g)'
args "--device /dev/kvm:/dev/kvm -v /var/local/container_shared/gradle/:/.gradle -v /var/local/container_shared/android-sdk:/usr/local/android-sdk -v /var/local/container_shared/android-home:/.android -v /var/local/container_shared/emulator_console_auth_token:/.emulator_console_auth_token -v /var/local/container_shared/analytics.settings:/analytics.settings"
}
}

environment {
//////// Define environment variables to point to the correct locations inside the container ////////
//////////// Most likely not edited by the developer
ANDROID_SDK_ROOT = "/usr/local/android-sdk"
// Deprecated: Still used by the used gradle version, once gradle respects ANDROID_SDK_ROOT, this can be removed
ANDROID_HOME = "/usr/local/android-sdk"
ANDROID_SDK_HOME = "/"
// Needed for compatibiliby to current Jenkins-wide Envs. Can be removed, once all builds are migrated to Pipeline
ANDROID_SDK_LOCATION = "/usr/local/android-sdk"
ANDROID_NDK = ""
// This is important, as we want the keep our gradle cache, but we can't share it between containers
// the cache could only be shared if the gradle instances could comunicate with each other
// imho keeping the cache per executor will have the least space impact
GRADLE_USER_HOME = "/.gradle/${env.EXECUTOR_NUMBER}"
// Otherwise user.home returns ? for java applications
JAVA_TOOL_OPTIONS = "-Duser.home=/tmp/"

//// jenkins-android-helper related variables
// set to any value to debug jenkins_android* scripts
ANDROID_EMULATOR_HELPER_DEBUG = ""
// get stdout of called subprocesses immediately
PYTHONUNBUFFERED = "true"

//////// Build specific variables ////////
//////////// May be edited by the developer on changing the build steps
}

options {
timeout(time: 6, unit: 'HOURS')
timestamps()
}

stages {
stage('Prepare build') {
steps {
script {
currentBuild.displayName = "#${env.BUILD_NUMBER}"
}
}
}

stage('Setup Android SDK') {
steps {
// Install Android SDK
lock("update-android-sdk-on-${env.NODE_NAME}") {
sh "./buildScripts/build_step_install_android_sdk"
}
}
}

stage('Setup Translations') {
steps {
sh '''
set +x
./gradlew generateCrowdinMetadataCatroid -PcrowdinKey=$crowdinKey
'''
}
}

stage('Start emulator') {
steps {
sh "./buildScripts/build_helper_start_emulator"
}
}

stage('Create Screenshots') {
steps {
sh "./gradlew generateScreenshotsCatroid"
}
post {
always {
// stop/kill emulator
sh "./buildScripts/build_helper_stop_emulator"
}

success {
publishHTML target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'fastlane/metadata/android',
reportFiles: 'screenshots.html',
reportName: 'Screenshots'
]
}
}
}

stage('Review') {
//agent none
options {
timeout(time: 6, unit: 'HOURS')
}
steps {
script {
env.APPROVE_DEPLOY = input message: 'User input required',
parameters: [choice(name: 'Deploy', choices: 'no\nyes',
description: 'Please review the Screenshots! Do you want to deploy this to Google Play?')]
}
}
}

stage('Upload Metadata') {
when {
environment name: 'APPROVE_DEPLOY', value: 'yes'
}
steps {
sh "fastlane android upload_Metadata_Catroid"
}
}

stage('Promote APK to production') {
when {
environment name: 'APPROVE_DEPLOY', value: 'yes'
}
steps {
sh "fastlane android promote_Catroid"
}
}
}

post {
always {
// Send notifications with standalone=false
script {
sendNotifications false
}
}
}
}
Loading

0 comments on commit 90ca0ad

Please sign in to comment.