forked from alphagov/smart-answers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkins.sh
executable file
·34 lines (25 loc) · 941 Bytes
/
jenkins.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash -x
set -e
# Try to merge master into the current branch, and abort if it doesn't exit
# cleanly (ie there are conflicts). This will be a noop if the current branch
# is master.
git merge --no-commit origin/master || git merge --abort
git clean -fdx
# Clone govuk-content-schemas depedency for contract tests
rm -rf tmp/govuk-content-schemas
git clone git@github.com:alphagov/govuk-content-schemas.git tmp/govuk-content-schemas
(
cd tmp/govuk-content-schemas
git checkout ${SCHEMA_GIT_COMMIT:-"master"}
)
export GOVUK_CONTENT_SCHEMAS_PATH=tmp/govuk-content-schemas
bundle install --path "/home/jenkins/bundles/${JOB_NAME}" --deployment
export DISPLAY=:99
if [ -z "$RUN_REGRESSION_TESTS" ]; then
bundle exec govuk-lint-ruby \
--format clang
RAILS_ENV=test TEST_COVERAGE=true bundle exec rake test
bundle exec rake assets:precompile
else
bundle exec ruby test/regression/smart_answers_regression_test.rb
fi