/
obs_testsuite_webui.sh
92 lines (78 loc) · 2.52 KB
/
obs_testsuite_webui.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
#
# This script runs both WebUI unit and integration tests and produces coverage
# and todo/fixme reports as well as code statistics.
#
###############################################################################
# Job configuration template
###############################################################################
#
# Project name: obs_testsuite_webui
# Description:
# OBS WebUI testsuite on git master branch.
#
# Updates source code repository and runs unit and integration tests. It also
# generates coverage reports.
#
# Source Code Management:
# Git:
# Repositories: git://github.com/openSUSE/open-build-service.git
# Branches to build: master
# Repository browser: githubweb
# URL: https://github.com/openSUSE/open-build-service
#
# Build Triggers:
# Poll SCM:
# Schedule: */5 * * * *
#
# Build:
# Execute shell:
# Command: sh dist/ci/obs_testsuite_webui.sh
#
# Post Build Actions:
# Publish JUnit test result report:
# Test report XMLs: src/webui/results/*.xml
# Publish Rails Notes report: 1
# Rake working directory: src/webui
# Publish Rails stats report: 1
# Rake working directory: src/webui
# Publish Rcov report:
# Rcov report directory: src/webui/coverage
#
###############################################################################
# Script content for 'Build' step
###############################################################################
#
# Either invoke as described above or copy into an 'Execute shell' 'Command'.
#
set -e
set -x
sh -xe `dirname $0`/obs_testsuite_common.sh
echo "Enter WebUI rails root"
cd src/webui
echo "Setup database configuration"
cp config/database.yml.example config/database.yml
echo "Setup additional configuration"
cp config/options.yml.example config/options.yml
echo "Install missing gems locally"
#rake gems:install # TODO: Fix webui to make this work!
echo "Set environment variables"
export RAILS_ENV=test
echo "Fix executable bits broken by 'Copy Artifacts' plugin"
chmod +x script/start_test_api \
../api/script/server \
../api/script/start_test_backend
echo "Initialize test database, run migrations, load seed data"
rake --trace db:drop db:create db:migrate
echo "Invoke rake"
rake --trace ci:setup:testunit test CI_REPORTS=results
cd ../..
echo "Contents of src/api/log/test.log:"
cat src/api/log/test.log
echo
echo "Contents of src/webui/log/test.log:"
cat src/webui/log/test.log
echo
echo "Remove log/tmp files to save disc space"
rm -rf src/api/{log,tmp}/* \
src/webui/{log,tmp}/*