Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- version: 2
- jobs:
- build:
- working_directory: /app
- docker:
- - image: smarthr/circleci-base
- environment:
- RAILS_ENV: test
- DB_HOST: 127.0.0.1
- REDIS_HOST: 127.0.0.1
- TZ: /usr/share/zoneinfo/Asia/Tokyo
- CIRCLE_TEST_REPORTS: /tmp/test-results
- SOME_YOUR_ENVIRONMENTS: some_value
- - image: mysql:5.7
- command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --innodb-large-prefix=true --innodb-file-format=Barracuda
- environment:
- MYSQL_USER: root
- MYSQL_ALLOW_EMPTY_PASSWORD: yes
- - image: redis
- steps:
- - checkout
- - restore_cache:
- name: Restore bundle cache
- keys:
- - bundle-{{ checksum "Gemfile.lock" }}
- - run:
- name: Run bundle install
- command: bundle install
- - save_cache:
- name: Store bundle cache
- key: bundle-{{ checksum "Gemfile.lock" }}
- paths:
- - vendor/bundle
- - run:
- name: Run Rubocop
- command: |
- test_reports_dir=$CIRCLE_TEST_REPORTS/rubocop
- mkdir -p $test_reports_dir
- junit_formatter_ruby=$(bundle show rubocop-junit-formatter)/lib/rubocop/formatter/junit_formatter.rb
- bundle exec rubocop -L | \
- circleci tests split --split-by=timings --timings-type=filename | \
- xargs bundle exec rubocop -D -R -r $junit_formatter_ruby -c .rubocop.yml --format RuboCop::Formatter::JUnitFormatter --out $test_reports_dir/rubocop.xml
- - restore_cache:
- name: Restore npm cache
- keys:
- - npm-{{ checksum "package.json" }}
- - run:
- name: Run npm install
- command: |
- npm cache clean
- npm install
- - save_cache:
- name: Store npm cache
- key: npm-{{ checksum "package.json" }}
- paths:
- - ./node_modules
- - run:
- name: Run Frontend Test
- command: |
- npm run deploy
- .run_frontend_sass_lint.sh
- .run_frontend_eslint.sh
- .run_frontend_flow.sh
- .run_frontend_spec.sh
- - run:
- name: Create DB
- command: |
- RAILS_ENV=test bundle exec rake db:create
- bundle exec rake db:schema:load
- - run:
- name: Run Test
- command: |
- test_reports_dir=$CIRCLE_TEST_REPORTS/rspec
- mkdir -p $test_reports_dir
- circleci tests glob "spec/**/*_spec.rb" | \
- circleci tests split --split-by=timings --timings-type=filename | \
- xargs bundle exec rspec --color --format RspecJunitFormatter --out $test_reports_dir/rspec.xml --format progress --require spec_helper --require rails_helper --tag ~type:profiling --profile --
- - run:
- name: Setup AWS credentials
- command: |
- mkdir -p ~/.aws
- printf "[default]\nregion = ap-northeast-1\naws_access_key_id = ${AWS_ACCESS_KEY_ID}\naws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}" > ~/.aws/config
- printf "[default]\naws_access_key_id = ${AWS_ACCESS_KEY_ID}\naws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}" > ~/.aws/credentials
- chmod 600 ~/.aws/*
- - deploy:
- command: ./deploy.sh
- - store_test_results:
- path: /tmp/test-results
- notify:
- webhooks:
- - url: YOUR_COVERALLS_WEBHOOK_URL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement