Skip to content

Commit

Permalink
Merge pull request #5350 from coolo/circleci_on_steroids3
Browse files Browse the repository at this point in the history
Circleci: merge the linting into the checkout_code job
  • Loading branch information
ChrisBr committed Jul 12, 2018
2 parents c3addfe + a961897 commit 5408592
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 34 deletions.
60 changes: 29 additions & 31 deletions .circleci/config.yml
Expand Up @@ -4,7 +4,6 @@ images:
- &common_frontend_config
user: frontend
environment:
CC_TEST_REPORTER_ID: b7a6ce504d06a446d7f677160fb92e7b40a1c6538cd888435404a6ae92c5140a
NOKOGIRI_USE_SYSTEM_LIBRARIES: 1

- &mariadb
Expand Down Expand Up @@ -48,12 +47,21 @@ aliases:
name: Setup application
command: cd src/api; bundle exec rake dev:bootstrap[old_test_suite] RAILS_ENV=test

- &repo_cache_key
# keep the prefix for the following aligned
- &save_repo_cache_key
key: v3-repo-{{ .Branch }}-{{ .Revision }}

- &initial_repo_restore
restore_cache:
keys:
- v3-repo-{{ .Branch }}-{{ .Revision }}
- v3-repo-{{ .Branch }}
- v3-repo

- &restore_repo
restore_cache:
<<: *repo_cache_key
keys:
- v3-repo-{{ .Branch }}-{{ .Revision }}

- &store_rspec_artefacts
store_artifacts:
Expand All @@ -72,43 +80,31 @@ jobs:
checkout_code:
docker:
- <<: *frontend_base
- <<: *mariadb
steps:
- *restore_repo
- *initial_repo_restore
- checkout
- run: *install_dependencies
- run: *wait_for_database
- run:
name: Setup application
command: cd src/api; bundle exec rake dev:bootstrap RAILS_ENV=test
- save_cache:
<<: *repo_cache_key
paths:
- .

lint:
docker:
- <<: *frontend_base
- <<: *mariadb
steps:
- *restore_repo
- run: *install_dependencies
- restore_cache:
key: v3-lint
key: v4-lint
- run:
name: Install jshint
command: sudo npm install -g jshint
- run: *wait_for_database
- run:
name: Setup application
command: cd src/api; bundle exec rake dev:prepare RAILS_ENV=test
- run:
name: Run linters
command: cd src/api; bundle exec rake dev:lint RAILS_ENV=test
- save_cache:
key: v3-lint
key: v4-lint-{{ epoch }}
paths:
- src/api/tmp/rubocop_cache_root_dir
- src/api/tmp/rubocop_cache_rails_dir
- run: rm -rf src/api/tmp/rubocop*
- run:
name: Setup application
command: cd src/api; bundle exec rake dev:prepare assets:precompile RAILS_ENV=test
- save_cache:
<<: *save_repo_cache_key
paths:
- src/api/tmp/rubocop_cache
- .

rspec:
docker:
Expand Down Expand Up @@ -152,6 +148,11 @@ jobs:
- run: *install_dependencies
- run: *init_git_submodule
- run: *wait_for_database
- run:
name: Check DB Structure
command: |
cd src/api;
bundle exec rake dev:lint:db RAILS_ENV=test
- run: *bootstrap_old_test_suite
- run: mkdir /home/frontend/minitest
- run:
Expand Down Expand Up @@ -198,9 +199,6 @@ workflows:
- backend_test:
requires:
- checkout_code
- lint:
requires:
- checkout_code
- rspec-bootstrap:
requires:
- checkout_code
Expand Down
2 changes: 1 addition & 1 deletion src/api/.rubocop.yml
Expand Up @@ -5,7 +5,7 @@ inherit_from: .rubocop_todo.yml
AllCops:
UseCache: true
CacheRootDirectory: tmp/rubocop_cache_rails_dir
MaxFilesInCache: 2000
MaxFilesInCache: 4000
Exclude:
- 'tmp/**/*'
- 'lib/templates/**/*'
Expand Down
9 changes: 7 additions & 2 deletions src/api/lib/tasks/dev.rake
Expand Up @@ -74,10 +74,15 @@ namespace :dev do
Rake::Task['haml_lint'].invoke
Rake::Task['dev:lint:rubocop:all'].invoke
sh 'jshint ./app/assets/javascripts/'
Rake::Task['db:structure:verify'].invoke
Rake::Task['db:structure:verify_no_bigint'].invoke
end

namespace :lint do
task :db do
desc 'Verify DB structure'
Rake::Task['db:structure:verify'].invoke
Rake::Task['db:structure:verify_no_bigint'].invoke
end

namespace :rubocop do
desc 'Run the ruby linter in rails and in root'
task all: [:root, :rails] do
Expand Down

0 comments on commit 5408592

Please sign in to comment.