From 8a1d375aa3ef3b6e782fdb5ff43eb3b27405ca41 Mon Sep 17 00:00:00 2001 From: tobrun Date: Mon, 10 Apr 2017 15:55:28 +0200 Subject: [PATCH 1/2] add CI integration --- plugins/app/build.gradle | 2 + plugins/app/gradle-checkstyle.gradle | 18 ++ .../testapp/ExampleInstrumentedTest.java | 2 +- .../plugins/testapp/ExampleUnitTest.java | 2 +- plugins/build.gradle | 5 - plugins/checkstyle.xml | 226 ++++++++++++++++++ 6 files changed, 248 insertions(+), 7 deletions(-) create mode 100644 plugins/app/gradle-checkstyle.gradle create mode 100644 plugins/checkstyle.xml diff --git a/plugins/app/build.gradle b/plugins/app/build.gradle index 3bcc7e663..7ce999c9a 100644 --- a/plugins/app/build.gradle +++ b/plugins/app/build.gradle @@ -28,3 +28,5 @@ dependencies { compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7' testCompile 'junit:junit:4.12' } + +apply from: 'gradle-checkstyle.gradle' \ No newline at end of file diff --git a/plugins/app/gradle-checkstyle.gradle b/plugins/app/gradle-checkstyle.gradle new file mode 100644 index 000000000..fdc4399f1 --- /dev/null +++ b/plugins/app/gradle-checkstyle.gradle @@ -0,0 +1,18 @@ +apply plugin: 'checkstyle' + +checkstyle { + toolVersion = "7.1.1" // 7.3 + configFile = "../checkstyle.xml" as File +} + +task checkstyle(type: Checkstyle) { + description 'Checks if the code adheres to coding standards' + group 'verification' + configFile file("../checkstyle.xml") + source 'src' + include '**/*.java' + exclude '**/gen/**' + exclude '**/style/*LayerTest.java' + classpath = files() + ignoreFailures = false +} diff --git a/plugins/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/testapp/ExampleInstrumentedTest.java b/plugins/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/testapp/ExampleInstrumentedTest.java index 5f1ffcf19..05d6b30d8 100644 --- a/plugins/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/testapp/ExampleInstrumentedTest.java +++ b/plugins/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/testapp/ExampleInstrumentedTest.java @@ -7,7 +7,7 @@ import org.junit.Test; import org.junit.runner.RunWith; -import static org.junit.Assert.*; +import static junit.framework.Assert.assertEquals; /** * Instrumentation test, which will execute on an Android device. diff --git a/plugins/app/src/test/java/com/mapbox/mapboxsdk/plugins/testapp/ExampleUnitTest.java b/plugins/app/src/test/java/com/mapbox/mapboxsdk/plugins/testapp/ExampleUnitTest.java index 1d0712fee..919eb744b 100644 --- a/plugins/app/src/test/java/com/mapbox/mapboxsdk/plugins/testapp/ExampleUnitTest.java +++ b/plugins/app/src/test/java/com/mapbox/mapboxsdk/plugins/testapp/ExampleUnitTest.java @@ -2,7 +2,7 @@ import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; /** * Example local unit test, which will execute on the development machine (host). diff --git a/plugins/build.gradle b/plugins/build.gradle index 1ea4bd055..184a0932b 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -1,14 +1,9 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.0' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files } } diff --git a/plugins/checkstyle.xml b/plugins/checkstyle.xml new file mode 100644 index 000000000..73424a2ca --- /dev/null +++ b/plugins/checkstyle.xml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 07620b1128cb9c19da65fac11b39095282430901 Mon Sep 17 00:00:00 2001 From: tobrun Date: Tue, 11 Apr 2017 09:41:14 +0200 Subject: [PATCH 2/2] add bitrise config file --- plugins/bitrise.yml | 81 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 plugins/bitrise.yml diff --git a/plugins/bitrise.yml b/plugins/bitrise.yml new file mode 100644 index 000000000..e0ab3979c --- /dev/null +++ b/plugins/bitrise.yml @@ -0,0 +1,81 @@ +--- +format_version: 1.3.1 +default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git +trigger_map: +- push_branch: "*" + workflow: primary +workflows: + primary: + steps: + - activate-ssh-key@3.1.1: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' + - git-clone@3.4.2: {} + - install-missing-android-tools@1.0.1: {} + - gradle-runner@1.5.4: + inputs: + - gradle_task: "$CHECKSTYLE_TASK" + - gradle-runner@1.5.4: + inputs: + - gradle_task: "$UNITTEST_TASK" + - gradle-runner@1.5.4: + inputs: + - gradle_task: "$GRADLE_TASK" + - script: + title: Configure Google Cloud SDK + inputs: + - content: |- + #!/bin/bash + # Install python tools for pip + sudo apt-get install -y gcc python-dev python-setuptools + sudo easy_install -U pip + sudo pip uninstall crcmod + sudo pip install -U crcmod + # Install Google Cloud SDK for Firebase + export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" + echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - + sudo apt-get update && sudo apt-get install -y google-cloud-sdk + - script: + title: Run Firebase Roboto tests + inputs: + - content: |- + #!/bin/bash + set -euo pipefail + echo "Downloading Google Cloud authentication:" + wget -O google-services.json "$BITRISEIO_GOOGLE_SERVICES_JSON_URL" + + echo "Run tests on firebase:" + gcloud auth activate-service-account --key-file google-services.json --project mapbox-plugins-android-4e407 + gcloud firebase test android run --type robo --app "$BITRISE_APK_PATH" --device-ids shamu --os-version-ids 22 --locales en --orientations portrait --timeout 10m + - deploy-to-bitrise-io@1.2.9: {} + - slack: + title: Post to Slack + inputs: + - webhook_url: "$SLACK_HOOK_URL" + - channel: "#mobile-bots" + - from_username: Bitrise Mapbox Plugins Android + - from_username_on_error: Bitrise Mapbox Plugins Android + - message: "<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}> for + by ${GIT_CLONE_COMMIT_COMMITER_NAME} passed" + - message_on_error: "<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}> + for + by ${GIT_CLONE_COMMIT_COMMITER_NAME} failed" + - icon_url: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-icon-128.png + - icon_url_on_error: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-error-icon-128.png +app: + envs: + - opts: + is_expand: false + GRADLE_BUILD_FILE_PATH: plugins/build.gradle + - opts: + is_expand: false + GRADLE_TASK: assembleDebug + - opts: + is_expand: false + CHECKSTYLE_TASK: checkstyle + - opts: + is_expand: false + UNITTEST_TASK: test + - opts: + is_expand: false + GRADLEW_PATH: plugins/gradlew \ No newline at end of file