2017-08-19 18:10:17 +08:00
|
|
|
# This script is run in the discourse_test docker image
|
|
|
|
# Available environment variables:
|
2017-12-20 22:46:38 +08:00
|
|
|
# => NO_UPDATE disables updating the source code within the discourse_test docker image
|
|
|
|
# => COMMIT_HASH used by the discourse_test docker image to load a specific commit of discourse
|
|
|
|
# this can also be set to a branch, e.g. "origin/tests-passed"
|
|
|
|
# => RUN_SMOKE_TESTS executes the smoke tests instead of the regular tests from docker.rake
|
|
|
|
# See lib/tasks/docker.rake and lib/tasks/smoke_test.rake for more information
|
2017-08-19 18:10:17 +08:00
|
|
|
|
2014-06-20 07:26:25 +08:00
|
|
|
def run_or_fail(command)
|
|
|
|
pid = Process.spawn(command)
|
|
|
|
Process.wait(pid)
|
|
|
|
exit 1 unless $?.exitstatus == 0
|
|
|
|
end
|
|
|
|
|
|
|
|
unless ENV['NO_UPDATE']
|
2018-05-15 21:09:49 +08:00
|
|
|
run_or_fail("git pull")
|
2014-06-20 07:26:25 +08:00
|
|
|
|
|
|
|
checkout = ENV['COMMIT_HASH'] || "HEAD"
|
|
|
|
run_or_fail("git checkout #{checkout}")
|
|
|
|
run_or_fail("bundle")
|
|
|
|
end
|
|
|
|
|
2017-12-20 22:46:38 +08:00
|
|
|
if ENV['RUN_SMOKE_TESTS']
|
|
|
|
run_or_fail("bundle exec rake smoke:test")
|
|
|
|
else
|
|
|
|
run_or_fail("bundle exec rake docker:test")
|
|
|
|
end
|