Commit 2b0a767a authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

RSpec tests harness: avoid useless Workhorse rebuilds

Since Workhorse upstream GitLab bundled Workhorse in the main
repository, the test harness is using it, with a detection system
to trigger rebuilds. Being based on Git, it wasn't working
properly, resulting in `bin/rspec` always rebuilding Workhorse.

Here we adapt the rebuild triggering logic to Mercurial

One could expect a Makefile calling the Go compiler to run fast
in any case, but that still took 14 seconds on my fast workstation,
the irony being that the tests we are using in development of
Heptapod are very seldom calling through Workhorse.

--HG--
branch : heptapod-stable
parent 4845ec82559c
Pipeline #20272 passed with stages
in 15 minutes and 2 seconds
......@@ -314,7 +314,10 @@ def wait(service)
def setup_workhorse
start = Time.now
return if skip_compile_workhorse?
if skip_compile_workhorse?
puts "\n==> GitLab Workhorse already setup and does not need rebuild."
return
end
puts "\n==> Setting up GitLab Workhorse..."
......@@ -335,12 +338,16 @@ def skip_compile_workhorse?
end
def workhorse_source_clean?
out = IO.popen(%w[git status --porcelain workhorse], &:read)
out = IO.popen(%w[hg status -mard workhorse], &:read)
$?.success? && out.empty?
end
def workhorse_tree
IO.popen(%w[git rev-parse HEAD:workhorse], &:read)
# Upstream GitLab uses the tree oid of workhorse/ to detect changes.
# Let's use the id of latest changeset that changed it, even if
# that is not so well-defined (it's acceptable to have sporadic
# unneeded rebuilds).
IO.popen(%w[hg log -l 1 workhorse -T {node}], &:read)
end
def workhorse_tree_file
......@@ -586,6 +593,8 @@ def component_timed_setup(component, install_dir:, version:, task:)
yield if block_given?
puts " #{component} set up in #{Time.now - start} seconds...\n"
else
puts "\n==> #{component} already setup and does not need rebuild."
end
rescue ComponentFailedToInstallError
puts "\n#{component} failed to install, cleaning up #{install_dir}!\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment