From c9e98898d18772d411e10b6c052621a38a1fde8c Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Wed, 22 Jul 2020 18:34:51 -0500 Subject: [PATCH] [POC] Setup Rake task Because I am tired of doing `bash -l`... for cross repo tests... Edit: Well... apparently it is required for anything `nvm` related... Edit 2: `nvm` seems to install then use, so just makes sense to have this as one step. Edit 3: `nvm` is a function, so have to source it first... ugh Edit 4: Set PATH for node. Add spec:cypress:ci exec task (sets path) Edit 5: Debugging... Edit 6: Forgot to add `../bin`... derp Edit 7: Call seed prior to spec:cypress to avoid DB loaded errors "DB loaded errors come from the following task: app:test:verify_no_db_access_loading_rails_environment --- Rakefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Rakefile b/Rakefile index 0556dfb09b69..de1e144ddc25 100644 --- a/Rakefile +++ b/Rakefile @@ -57,6 +57,24 @@ namespace :spec do desc "Run all cypress specs" task :cypress => ["app:cypress:ui:run"] + namespace :cypress do + task :ci => ["ci:set_node_path", "app:cypress:ui:seed", "spec:cypress"] + + task "ci:install_yarn" do + sh "/bin/bash", "-c", "source ~/.nvm/nvm.sh && nvm install 12 && npm install -g yarn" + end + + task "ci:set_node_path" do + ENV["PATH"] = "#{Dir.glob("/home/travis/.nvm/versions/node/v12*").sort.last}/bin:#{ENV["PATH"]}" + # puts;puts;puts + # puts ">>>>>> PATH: #{ENV["PATH"]}" + # puts;puts;puts + end + + desc "Setup for CI" + task "ci:setup" => ["ci:install_yarn", "ci:set_node_path", "update:ui"] + end + desc "Try to compile assets" task :compile => ["app:assets:precompile"]