From b8367cf76870bdb063c63817c90751a38a0aaf61 Mon Sep 17 00:00:00 2001 From: Melih Aksoy Date: Mon, 1 Jul 2019 17:18:09 +0200 Subject: [PATCH] Working on CI Working on CI --- .circleci/config.yml | 43 ++++++++++++++++++++++++++++--------------- README.md | 2 ++ build.gradle | 6 ++++++ fastlane/Fastfile | 41 +++++++++++++++++++++++++++-------------- 4 files changed, 63 insertions(+), 29 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2c4ab41..fb50d2b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,15 +1,28 @@ -# Use the latest 2.1 version of CircleCI pipeline processing engine, see https://circleci.com/docs/2.0/configuration-reference/ -version: 2.1 - -# Use a package of configuration called an orb, see https://circleci.com/docs/2.0/orb-intro/ -orbs: - # Declare a dependency on the welcome-orb - welcome: circleci/welcome-orb@0.3.1 - -# Orchestrate or schedule a set of jobs, see https://circleci.com/docs/2.0/workflows/ -workflows: - # Name the workflow "Welcome" - Welcome: - # Run the welcome/run job in its own container - jobs: - - welcome/run \ No newline at end of file +version: 2 +jobs: + build: + working_directory: ~/code + docker: + - image: circleci/android:api-28 + environment: + JVM_OPTS: -Xmx3200m + steps: + - checkout + - restore_cache: + key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} + # - run: + # name: Chmod permissions #if permission for Gradlew Dependencies fail, use this. + # command: sudo chmod +x ./gradlew + - run: + name: Install bundle + command: | + gem install bundler + bundle install + - run: + name: Detekt + command: fastlane detekt + - store_artifacts: # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/ + path: reports/detekt + - store_test_results: # for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/ + path: reports/tests + # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples diff --git a/README.md b/README.md index 05d7f6d..48d1af7 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ # Rocket Science + +[![CircleCI](https://circleci.com/gh/melihaksoy/RocketScience/tree/dev.svg?style=svg)](https://circleci.com/gh/melihaksoy/RocketScience/tree/dev) diff --git a/build.gradle b/build.gradle index 523c5df..6ad31aa 100644 --- a/build.gradle +++ b/build.gradle @@ -36,4 +36,10 @@ task clean(type: Delete) { delete rootProject.buildDir } +task removeReports(type: Delete) { + delete fileTree(rootProject.projectDir.path + "/reports") { + include '**/*.*' + } +} + apply from: "scripts/dependencies.gradle" diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 19c557c..620d759 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -13,26 +13,39 @@ # Uncomment the line if you want fastlane to automatically update itself # update_fastlane +# ================ Platform ================ + default_platform(:android) +# ================ Lanes ================ + platform :android do - desc "Runs all the tests" - lane :test do - gradle(task: "test") + + before_all do + clean_reports() end - desc "Submit a new Beta Build to Crashlytics Beta" - lane :beta do - gradle(task: "clean assembleRelease") - crashlytics - - # sh "your_script.sh" - # You can also use other beta testing services here + desc "Detekt checks" + lane :detekt do + run_detekt() end - desc "Deploy a new version to the Google Play" - lane :deploy do - gradle(task: "clean assembleRelease") - upload_to_play_store + desc "Runs all tests in all modules" + lane :test_all do + run_all_tests() + end + +# ================ Gradle tasks ================ + + def run_detekt + gradle(task: "detekt --continue") + end + + def clean_reports + gradle(task: "removeReports") + end + + def run_all_tests + gradle(task: "test --continue") end end