Skip to content

Instantly share code, notes, and snippets.

@agirlnamedsophia
Created December 3, 2018 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agirlnamedsophia/0e69a2e47eef41395fd6cf592f01ee0a to your computer and use it in GitHub Desktop.
Save agirlnamedsophia/0e69a2e47eef41395fd6cf592f01ee0a to your computer and use it in GitHub Desktop.
coach--lint (Gemfile):
resource_class: small
environment:
BUNDLE_GEMFILE: Gemfile
docker:
- image: ruby:2.4.2
environment:
GEM_SOURCE: https://rubygems.org
RAILS_ENV: test
RACK_ENV: test
working_directory: "~/coach"
steps:
- attach_workspace:
at: "/tmp/"
- run:
name: Skip this job if the project has not changed
command: |
if [[ -n $CIRCLE_PULL_REQUEST ]] && [[ ! -f "/tmp/changed_projects/coach" ]]; then
circleci step halt
fi
- run:
name: Generate git refs cache key
command: date +%Y-%m-%d > /tmp/.git-refs-cache-key
- restore_cache:
keys:
- v1-git-refs-{{ checksum "/tmp/.git-refs-cache-key" }}
- v1-git-refs-
- run:
name: Checkout code
command: checkout
- save_cache:
paths: ".git"
key: v1-git-refs-{{ checksum "/tmp/.git-refs-cache-key" }}
- restore_cache:
keys:
- v3-coach-Gemfile-{{ checksum "coach/coach.yml" }}-{{ checksum "coach/Gemfile.lock"
}}
- v3-coach-Gemfile-
- run:
name: install dependencies
command: |
cd coach
bundle check --path vendor/bundle \
|| bundle install --clean --jobs=4 --retry=3 --path vendor/bundle --frozen
- save_cache:
paths:
- coach/vendor/bundle
key: v3-coach-Gemfile-{{ checksum "coach/coach.yml" }}-{{ checksum "coach/Gemfile.lock"
}}
- run:
name: run rubocop
command: |
cd coach
mkdir -p /tmp/artifacts
bundle exec rubocop --format progress \
--format html \
--out /tmp/artifacts/rubocop-report.html
- run:
name: run brakeman
command: |
cd coach
mkdir -p /tmp/artifacts
bundle exec brakeman --output /tmp/artifacts/brakeman.html \
--exit-on-warn \
--exit-on-error
- store_artifacts:
path: "/tmp/artifacts"
destination: artifacts
- run:
name: notify coach of Build Failures
command: notify_coach build_failures
when: on_fail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment