Skip to content

Instantly share code, notes, and snippets.

@ziglee
Last active March 14, 2018 17:13
Show Gist options
  • Save ziglee/9ab05ecc5c4bcc8c0e6f84f64c793942 to your computer and use it in GitHub Desktop.
Save ziglee/9ab05ecc5c4bcc8c0e6f84f64c793942 to your computer and use it in GitHub Desktop.
CircleCI android + sonarqube scanner
version: 2
jobs:
build:
dependencies:
pre:
- echo y | android update sdk --no-ui --all --filter "com.android.tools.build:gradle:3.0.1"
docker:
- image: circleci/android:api-26-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- run:
name: chmod permissions
command: chmod +x ./gradlew
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Sonarqube
command: ./gradlew sonarqube -Dsonar.projectKey=my-android -Dsonar.projectName=my-android -Dsonar.host.url=http://localhost:9000 -Dsonar.login=$SONAR_LOGIN -Dsonar.projectVersion=$CIRCLE_BRANCH-$CIRCLE_BUILD_NUM -Dsonar.links.ci=$CIRCLE_BUILD_URL
- run:
name: Run Tests
command: ./gradlew lint test
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment