forked from shakacode/react-webpack-rails-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci.rake
45 lines (37 loc) · 1.06 KB
/
ci.rake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
if Rails.env.development? || Rails.env.test?
# See tasks/linters.rake
task :bundle_audit do
puts Rainbow("Running security audit on gems (bundle_audit)").green
Rake::Task["bundle_audit"].invoke
end
task :security_audit do
puts Rainbow("Running security audit on code (brakeman)").green
sh "brakeman --exit-on-warn --quiet -A -z"
end
task :js_tests do
puts Rainbow("Running JavaScript tests").green
sh "yarn run test:client"
end
task :rspec_tests do
puts Rainbow("Running RSpec tests").green
sh "rspec"
end
namespace :ci do
desc "Run all audits and tests"
# rspec_tests must be before lint and js_tests to build the locale files
task all: %i[environment rspec_tests lint js_tests bundle_audit security_audit] do
begin
puts "All CI tasks"
puts Rainbow("PASSED").green
puts ""
rescue StandardError => e
puts e.to_s
puts Rainbow("FAILED").red
puts ""
raise(e)
end
end
end
task ci: "ci:all"
task(:default).clear.enhance([:ci])
end