From a8fe6ed4ff74305a0e2575effde639f14cf10f9b Mon Sep 17 00:00:00 2001 From: panpanini Date: Tue, 1 Oct 2019 10:38:44 -0700 Subject: [PATCH 1/2] Add ktlint to circleci config --- .circleci/config.yml | 48 ++++++++++++++++++++++++-------------------- Dangerfile | 4 ++++ Gemfile | 5 +++++ 3 files changed, 35 insertions(+), 22 deletions(-) create mode 100644 Dangerfile create mode 100644 Gemfile diff --git a/.circleci/config.yml b/.circleci/config.yml index 4fec3ad..ba28a07 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,4 @@ -version: 2 +version: 2.1 jobs: build: docker: @@ -38,8 +38,12 @@ jobs: path: ~/test-results - store_artifacts: path: ~/test-results/junit + - persist_to_workspace: + root: . + paths: + - . - release: + ktlint: docker: - image: circleci/openjdk:8-jdk working_directory: ~/protok @@ -48,25 +52,25 @@ jobs: # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m TERM: dumb - branches: - only: - - master steps: - - checkout - - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ checksum "build.gradle" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - - run: gradle dependencies - - - save_cache: - paths: - - ~/.gradle - key: v1-dependencies-{{ checksum "build.gradle" }} + - attach_workspace: + at: . + - run: + name: Install ktlint + command: | + curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.34.2/ktlint + chmod a+x ktlint + echo 'export PATH=/home/circleci/repo:$PATH' >> $BASH_ENV + source $BASH_ENV + - run: + name: Put comments indicated by Danger + command: | + bundle install --path vendor/bundle + bundle exec danger --dangerfile=Dangerfile --danger_id="danger" + when: always - # run tests! - - run: gradle jar +workflows: + branch: + jobs: + - build + - ktlint \ No newline at end of file diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 0000000..31bb900 --- /dev/null +++ b/Dangerfile @@ -0,0 +1,4 @@ +# Stop reporting warnings/errors on the code out of range +github.dismiss_out_of_range_messages + +ktlint.lint(inline_mode: true) \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..a64137c --- /dev/null +++ b/Gemfile @@ -0,0 +1,5 @@ +# frozen_string_literal: true +source "https://rubygems.org" + +gem 'danger' +gem 'danger-ktlint' \ No newline at end of file From c0e815eb3d7663ac881851c6ac65ac851448e18a Mon Sep 17 00:00:00 2001 From: panpanini Date: Tue, 1 Oct 2019 10:55:30 -0700 Subject: [PATCH 2/2] add gem install bundle --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index ba28a07..6bfde2d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,6 +65,7 @@ jobs: - run: name: Put comments indicated by Danger command: | + gem install bundle bundle install --path vendor/bundle bundle exec danger --dangerfile=Dangerfile --danger_id="danger" when: always