Giter VIP home page Giter VIP logo

hellojenkins's Introduction

Hello Jenkins App

This is an Android multi-module demo app to verify the proper configuration of a Jenkins CI server and a SonarQube Server, should work straightforward if your sonarQube server is at localhost:9000

I have wrote two extensive Medium articles explaining:

How to configure JaCoCo Coverage in your apps:

In your app module add the Jacoco-android-gradle-plugin https://github.com/arturdm/jacoco-android-gradle-plugin

buildscript {
  repositories {
    ...
    jcenter()
  }
  dependencies {
    ...
    classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
  }
}

apply plugin: 'jacoco-android'

jacoco {
    toolVersion = jacocoVersion
}

In your java modules just add:

apply plugin: "jacoco"

jacoco {
    toolVersion = jacocoVersion
}

In your parent build.gradle add:

ext {
    jacocoVersion = '0.7.8'
}

How to configure sonarQube in your apps:

In your parent build.gradle add these lines

plugins {
    id "org.sonarqube" version "2.2.1"
}

sonarqube {
    properties {
        def jenkinsJobName = System.getenv('JOB_NAME')
        def jenkinsJobBuild = System.getenv('BUILD_NUMBER')

        def projectVersion = "nonJenkinsBuild_1.0"
        def projectName = "HelloJenkins"
        def projectKey = "hellojenkins:hellojenkins"
        def branch = "master"

        if (jenkinsJobName && jenkinsJobBuild) {
            jenkinsJobName = jenkinsJobName.replace(" ", "_")
            projectVersion = jenkinsJobName + '_' + jenkinsJobBuild
        }

        //change url if sonarqube is not at localhost:9000
        property "sonar.host.url", "http://localhost:9000"
        property "sonar.projectKey", projectKey // some shortcut name
        property "sonar.projectName", projectName
        property "sonar.projectVersion", projectVersion
        property "sonar.branch", branch
        property "sonar.sourceEncoding", "UTF-8"
        property "sonar.scm.provider", "git"
        property "sonar.java.coveragePlugin", "jacoco"
    }
}

Note: if the Analysis is triggered from Jenkins server, environmental variables Job_Name and Buid_Number will be used to tag the reports, otherwise "nonJenkinsBuild_1.0" will be used.

In your app module add:

sonarqube {
    properties {
        property "sonar.jacoco.reportPath", "build/jacoco/testDebugUnitTest.exec"
        property "sonar.junit.reportsPath", "build/test-results/debug"
    }
}

Nothing is required in java modules.

Cloud testing

If you want to test Firebase Test Lab integration checkout "feature/fireTestLab" branch.

If you want to test Genymotion Cloud integration please checkout "feature/genymotion" branch.

Amazon Device Farm doesn't require any project configuration

hellojenkins's People

Contributors

pamartineza avatar cooperrs avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.