From 1b6f43892ceabce8a7c40d1ea77dade2a718b82a Mon Sep 17 00:00:00 2001 From: gabrielburnworth Date: Fri, 15 Feb 2019 15:46:27 -0800 Subject: [PATCH] misc --- .circleci/config.yml | 5 ++--- .ruby-version | 2 +- latest_corpus.rb | 31 +++++++++++++++++-------------- lib/tasks/coverage.rake | 2 +- run_all_ci_tasks.sh | 16 +++++----------- 5 files changed, 26 insertions(+), 30 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b52024121..4c58e00e4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,8 +1,7 @@ version: 2 -# executor: "machine" jobs: build: - executor: "machine" + machine: true steps: - checkout - run: @@ -26,7 +25,7 @@ jobs: - run: name: Run Ruby tests command: | - sudo docker-compose run web rspec spec + sudo docker-compose run web rspec spec - run: name: Run linters command: | diff --git a/.ruby-version b/.ruby-version index 73462a5a1..6a6a3d8e3 100755 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.5.1 +2.6.1 diff --git a/latest_corpus.rb b/latest_corpus.rb index b520e6e3c..bfca8e9db 100755 --- a/latest_corpus.rb +++ b/latest_corpus.rb @@ -1,5 +1,5 @@ class CorpusEmitter - PIPE = "\n | " + PIPE = "\n | " class CSArg TRANSLATIONS = {"integer" => "number", @@ -22,7 +22,7 @@ class CorpusEmitter .map { |v| TRANSLATIONS[v] || v.camelize } .uniq .sort - .join(PIPE) + .join("\n | ") end def to_ts @@ -76,9 +76,8 @@ class CorpusEmitter end def to_ts - """ + <<~NODE_EXPORTS #{body_type} - export interface #{camelize} { kind: #{name.inspect}; args: {#{arg_names} @@ -86,7 +85,7 @@ class CorpusEmitter comment?: string | undefined; #{body_attr} } - """ + NODE_EXPORTS end end @@ -98,24 +97,28 @@ class CorpusEmitter NODES = HASH[:nodes].map { |x| CSNode.new(x) } def const(key, val) - "\nexport const #{key} = #{val};" + "export const #{key} = #{val};" end def enum_type(key, val, inspect = true) - "\nexport type #{key} = #{(inspect ? val.map(&:inspect) : val).join(PIPE)};" + "export type #{key} = #{(inspect ? val.map(&:inspect) : val).join(PIPE)};" end def self.generate self.new.generate end + def overwrite_warning_comment + <<~COMMENT.strip + // THIS INTERFACE WAS AUTO GENERATED ON #{Date.today} + // DO NOT EDIT THIS FILE. + // IT WILL BE OVERWRITTEN ON EVERY CELERYSCRIPT UPGRADE. + COMMENT + end + def generate - result = NODES.map(&:to_ts) - result.unshift(""" - // THIS INTERFACE WAS AUTO GENERATED ON #{Date.today} - // DO NOT EDIT THIS FILE. - // IT WILL BE OVERWRITTEN ON EVERY CELERYSCRIPT UPGRADE. - """) + result = NODES.map(&:to_ts).map(&:strip) + result.unshift(overwrite_warning_comment) result.push(enum_type :CeleryNode, NODES.map(&:name).map(&:camelize), false) result.push(const(:LATEST_VERSION, Sequence::LATEST_VERSION)) result.push(const :DIGITAL, CeleryScriptSettingsBag::DIGITAL) @@ -142,7 +145,7 @@ class CorpusEmitter result.push(enum_type :AllowedGroupTypes, CeleryScriptSettingsBag::ALLOWED_EVERY_POINT_TYPE) File.open("latest_corpus.ts", "w") do |f| - f.write(result.join.gsub("\n\n\n", "\n").gsub("\n\n", "\n").gsub("\n\n", "\n").strip) + f.write(result.join("\n\n").concat("\n")) end end end diff --git a/lib/tasks/coverage.rake b/lib/tasks/coverage.rake index 66c59b03d..072eab739 100644 --- a/lib/tasks/coverage.rake +++ b/lib/tasks/coverage.rake @@ -1,7 +1,7 @@ COVERAGE_FILE_PATH = "./coverage_fe/index.html" THRESHOLD = 0.001 REPO_URL = "https://api.github.com/repos/Farmbot/Farmbot-Web-App" -CURRENT_BRANCH = ENV.fetch("CIRCLE_BRANCH", "staging") +CURRENT_BRANCH = ENV.fetch("CIRCLE_BRANCH", "staging") # "staging" or "pull/11" CURRENT_COMMIT = ENV.fetch("CIRCLE_SHA1", "") CSS_SELECTOR = ".fraction" FRACTION_DELIM = "/" diff --git a/run_all_ci_tasks.sh b/run_all_ci_tasks.sh index 8832f17f3..7304e6c10 100755 --- a/run_all_ci_tasks.sh +++ b/run_all_ci_tasks.sh @@ -1,21 +1,15 @@ #!/bin/sh -sudo docker-compose run web npm run tslint & +sudo docker-compose run web npm run linters & P1=$! -sudo docker-compose run web npm run sass-lint & +sudo docker-compose run web rspec spec & P2=$! -sudo docker-compose run web npm run typecheck & +sudo docker-compose run web npm run test-slow & P3=$! -sudo docker-compose run web rspec spec & +sudo docker-compose run web npm run coverage & P4=$! -sudo docker-compose run web npm run test-slow & -P5=$! - -sudo docker-compose run web npm run coverage & -P6=$! - -wait $P1 $P2 $P3 $P4 $P5 $P6 +wait $P1 $P2 $P3 $P4