diff --git a/.circleci/config.yml b/.circleci/config.yml index 4fec3ad..6bfde2d 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,26 @@ 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: | + gem install bundle + 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