Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. version: 2
  2.  
  3. jobs:
  4. build:
  5. working_directory: /app
  6. docker:
  7. - image: smarthr/circleci-base
  8. environment:
  9. RAILS_ENV: test
  10. DB_HOST: 127.0.0.1
  11. REDIS_HOST: 127.0.0.1
  12. TZ: /usr/share/zoneinfo/Asia/Tokyo
  13. CIRCLE_TEST_REPORTS: /tmp/test-results
  14. SOME_YOUR_ENVIRONMENTS: some_value
  15. - image: mysql:5.7
  16. command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --innodb-large-prefix=true --innodb-file-format=Barracuda
  17. environment:
  18. MYSQL_USER: root
  19. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  20. - image: redis
  21. steps:
  22. - checkout
  23.  
  24. - restore_cache:
  25. name: Restore bundle cache
  26. keys:
  27. - bundle-{{ checksum "Gemfile.lock" }}
  28.  
  29. - run:
  30. name: Run bundle install
  31. command: bundle install
  32.  
  33. - save_cache:
  34. name: Store bundle cache
  35. key: bundle-{{ checksum "Gemfile.lock" }}
  36. paths:
  37. - vendor/bundle
  38.  
  39. - run:
  40. name: Run Rubocop
  41. command: |
  42. test_reports_dir=$CIRCLE_TEST_REPORTS/rubocop
  43. mkdir -p $test_reports_dir
  44. junit_formatter_ruby=$(bundle show rubocop-junit-formatter)/lib/rubocop/formatter/junit_formatter.rb
  45.  
  46. bundle exec rubocop -L | \
  47. circleci tests split --split-by=timings --timings-type=filename | \
  48. xargs bundle exec rubocop -D -R -r $junit_formatter_ruby -c .rubocop.yml --format RuboCop::Formatter::JUnitFormatter --out $test_reports_dir/rubocop.xml
  49.  
  50. - restore_cache:
  51. name: Restore npm cache
  52. keys:
  53. - npm-{{ checksum "package.json" }}
  54.  
  55. - run:
  56. name: Run npm install
  57. command: |
  58. npm cache clean
  59. npm install
  60.  
  61. - save_cache:
  62. name: Store npm cache
  63. key: npm-{{ checksum "package.json" }}
  64. paths:
  65. - ./node_modules
  66.  
  67. - run:
  68. name: Run Frontend Test
  69. command: |
  70. npm run deploy
  71. .run_frontend_sass_lint.sh
  72. .run_frontend_eslint.sh
  73. .run_frontend_flow.sh
  74. .run_frontend_spec.sh
  75.  
  76. - run:
  77. name: Create DB
  78. command: |
  79. RAILS_ENV=test bundle exec rake db:create
  80. bundle exec rake db:schema:load
  81.  
  82. - run:
  83. name: Run Test
  84. command: |
  85. test_reports_dir=$CIRCLE_TEST_REPORTS/rspec
  86. mkdir -p $test_reports_dir
  87.  
  88. circleci tests glob "spec/**/*_spec.rb" | \
  89. circleci tests split --split-by=timings --timings-type=filename | \
  90. 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 --
  91.  
  92. - run:
  93. name: Setup AWS credentials
  94. command: |
  95. mkdir -p ~/.aws
  96. printf "[default]\nregion = ap-northeast-1\naws_access_key_id = ${AWS_ACCESS_KEY_ID}\naws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}" > ~/.aws/config
  97. printf "[default]\naws_access_key_id = ${AWS_ACCESS_KEY_ID}\naws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}" > ~/.aws/credentials
  98. chmod 600 ~/.aws/*
  99.  
  100. - deploy:
  101. command: ./deploy.sh
  102.  
  103. - store_test_results:
  104. path: /tmp/test-results
  105.  
  106. notify:
  107. webhooks:
  108. - url: YOUR_COVERALLS_WEBHOOK_URL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement