task and dep updates

pull/1389/head
gabrielburnworth 2019-08-23 14:19:02 -07:00
parent 538ef0f1e4
commit d868625ba3
3 changed files with 40 additions and 24 deletions

View File

@ -2,6 +2,8 @@ COVERAGE_FILE_PATH = "./coverage_fe/index.html"
THRESHOLD = 0.001
REPO_URL = "https://api.github.com/repos/Farmbot/Farmbot-Web-App"
LATEST_COV_URL = "https://coveralls.io/github/FarmBot/Farmbot-Web-App.json"
COV_API_BUILDS_PER_PAGE = 5
COV_BUILDS_TO_FETCH = 15
PULL_REQUEST = ENV.fetch("CIRCLE_PULL_REQUEST", "/0")
CURRENT_BRANCH = ENV.fetch("CIRCLE_BRANCH", "staging") # "staging" or "pull/11"
CURRENT_COMMIT = ENV.fetch("CIRCLE_SHA1", "")
@ -81,14 +83,22 @@ def fetch_builds_for_page(page_number)
open_json("#{LATEST_COV_URL}?page=#{page_number}")["builds"]
end
# Fetch coverage data from the last 10 builds.
# Number of coverage build data pages required to fetch the desired build count.
def cov_pages_required
(COV_BUILDS_TO_FETCH / COV_API_BUILDS_PER_PAGE.to_f).ceil
end
# Fetch coverage data from the last COV_BUILDS_TO_FETCH builds.
def fetch_build_data()
build_data = fetch_builds_for_page(1)
build_data.push(*fetch_builds_for_page(2))
for page_number in 2..cov_pages_required
build_data.push(*fetch_builds_for_page(page_number))
end
clean_build_data = build_data
.reject { |build| build["covered_percent"].nil? }
.reject { |build| build["branch"].include? "/" }
puts "Using data from #{clean_build_data.length} recent coverage builds."
puts "Using data from #{clean_build_data.length} of #{build_data.length}" \
" recent coverage builds."
clean_build_data.map { |build| relevant_data(build) }
end
@ -184,13 +194,13 @@ namespace :coverage do
if remote[:percent].nil? && current_branch != "staging"
puts "Error getting coveralls data for '#{current_branch}'."
puts "Attempting to use staging build coveralls data."
puts "Attempting to use staging build coveralls data from history."
remote = latest_build_data(coverage_history_data, "staging")
end
if remote[:percent].nil?
puts "Error getting coveralls data for staging."
puts "Attempting to use latest build coveralls data."
puts "Attempting to use latest build coveralls data in history."
remote = latest_build_data(coverage_history_data, "*")
end

View File

@ -1,5 +1,6 @@
PACKAGE_JSON_FILE = "./package.json"
DEPS_KEY = "dependencies"
DEV_DEPS_KEY = "devDependencies"
EXCLUDE = []
# Load package.json as JSON.
@ -50,10 +51,15 @@ namespace :fe do
puts "=" * 40
puts "#{PACKAGE_JSON_FILE} AVAILABLE UPDATES:"
available_upgrades.each do |dep, new_version|
current_version = package_json[DEPS_KEY][dep]
deps_key = DEPS_KEY
current_version = package_json[deps_key][dep]
if current_version.nil?
deps_key = DEV_DEPS_KEY
current_version = package_json[deps_key][dep]
end
padding = ' ' * (max_key_length - dep.length)
puts " #{dep} #{padding} #{current_version} -> #{new_version}"
package_json[DEPS_KEY][dep] = new_version
package_json[deps_key][dep] = new_version
end
puts "=" * 40

View File

@ -25,30 +25,30 @@
"license": "MIT",
"dependencies": {
"@babel/core": "7.5.5",
"@blueprintjs/core": "3.17.1",
"@blueprintjs/datetime": "3.11.0",
"@blueprintjs/select": "3.9.0",
"@blueprintjs/core": "3.18.0",
"@blueprintjs/datetime": "3.9.2",
"@blueprintjs/select": "3.10.0",
"@types/enzyme": "3.10.3",
"@types/jest": "24.0.17",
"@types/lodash": "4.14.136",
"@types/jest": "24.0.18",
"@types/lodash": "4.14.137",
"@types/markdown-it": "0.0.8",
"@types/moxios": "0.4.8",
"@types/node": "12.6.9",
"@types/node": "12.7.2",
"@types/promise-timeout": "1.3.0",
"@types/react": "16.8.24",
"@types/react": "16.9.2",
"@types/react-color": "3.0.1",
"@types/react-dom": "16.8.5",
"@types/react-redux": "7.1.1",
"@types/react-dom": "16.9.0",
"@types/react-redux": "7.1.2",
"axios": "0.19.0",
"boxed_value": "1.0.0",
"browser-speech": "1.1.1",
"coveralls": "3.0.5",
"coveralls": "3.0.6",
"enzyme": "3.10.0",
"enzyme-adapter-react-16": "1.14.0",
"farmbot": "8.1.6",
"i18next": "17.0.9",
"i18next": "17.0.12",
"lodash": "4.17.15",
"markdown-it": "9.0.1",
"markdown-it": "9.1.0",
"markdown-it-emoji": "1.4.0",
"moment": "2.24.0",
"moxios": "0.4.0",
@ -67,18 +67,18 @@
"redux": "4.0.4",
"redux-immutable-state-invariant": "2.1.0",
"redux-thunk": "2.3.0",
"sass": "1.22.9",
"sass": "1.22.10",
"sass-lint": "1.13.1",
"takeme": "0.11.2",
"takeme": "0.11.3",
"ts-jest": "24.0.2",
"ts-lint": "4.5.1",
"tslint": "5.18.0",
"tslint": "5.19.0",
"typescript": "3.5.3",
"which": "1.3.1"
},
"devDependencies": {
"jest": "24.8.0",
"jest-cli": "24.8.0",
"jest": "24.9.0",
"jest-cli": "24.9.0",
"jest-skipped-reporter": "0.0.4",
"jshint": "2.10.2",
"madge": "3.4.4"