-
Notifications
You must be signed in to change notification settings - Fork 12
/
run_integration.sh
executable file
·116 lines (89 loc) · 3.16 KB
/
run_integration.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash -ex
set -o pipefail
# set the desired version of Xcode
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
XCWORKSPACE="Example/MMFlowViewDemo.xcworkspace"
XCSCHEME="MMFlowViewDemo"
if [ -z "${OCLINT}" ]; then
OCLINT=`which oclint`
fi
if [ -z "${OCLINT_XCODEBUILD}" ]; then
OCLINT_XCODEBUILD=`which oclint-xcodebuild`
fi
if [ -z "${OCLINT_JSON_COMPILATION_DATABASE}" ]; then
OCLINT_JSON_COMPILATION_DATABASE=`which oclint-json-compilation-database`
fi
if [ -z "${XCTOOL}" ]; then
XCTOOL=`which xctool`
fi
if [ -z "${XCODEBUILD}" ]; then
XCODEBUILD=`which xcodebuild`
fi
if [ -z "${DOT}" ]; then
DOT=`which dot`
fi
if [ -z "${WORKSPACE}" ]; then
echo "[*] workspace nil, setting to working copy"
REALPATH=$([[ -L $0 ]] && echo $(dirname $0)/$(readlink $0) || echo $0)
WORKSPACE=$(cd $(dirname $REALPATH); pwd)
fi
GCOVCMD=`xcrun -f gcov`
echo "[*] Cleaning workspace"
if [ -f compile_commands.json ]; then
rm compile_commands.json
fi
if [ -d build ]; then
rm -Rf build
fi
echo "[*] Perform tests"
${XCTOOL} -workspace ${XCWORKSPACE} \
-scheme ${XCSCHEME} \
-reporter junit:${WORKSPACE}/build/test-reports/junit-report.xml \
-reporter plain \
-configuration Debug \
DSTROOT=${WORKSPACE}/build/Products \
OBJROOT=${WORKSPACE}/build/Intermediates \
SYMROOT=${WORKSPACE}/build \
SHARED_PRECOMPS_DIR=${WORKSPACE}/build/Intermediates/PrecompiledHeaders \
GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \
clean test
echo "[*] Generating code-coverage results"
scripts/gcovr --gcov-executable=${GCOVCMD} -x -o ${WORKSPACE}/build/test-reports/coverage.xml --root=. --exclude='(.*Spec\.m)|(.*.h)|(Example/*)'
echo "[*] Performing code quality analysis"
mkdir -p ${WORKSPACE}/build/reports
scripts/objc_dep.py Classes/ -i Specs osx/Specs Example > ${WORKSPACE}/build/reports/dependency.dot
${DOT} -Tpng -o${WORKSPACE}/build/reports/dependency.png ${WORKSPACE}/build/reports/dependency.dot
echo "<html><body><img src=\"dependency.png\"></body></html>" > build/reports/index.html
mkdir -p ${WORKSPACE}/build/oclint
${XCODEBUILD} -workspace ${XCWORKSPACE} \
-scheme ${XCSCHEME} \
-configuration Release \
DSTROOT=${WORKSPACE}/build/Products \
OBJROOT=${WORKSPACE}/build/Intermediates \
SYMROOT=${WORKSPACE}/build \
SHARED_PRECOMPS_DIR=${WORKSPACE}/build/Intermediates/PrecompiledHeaders \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \
clean
${XCODEBUILD} -workspace ${XCWORKSPACE} \
-scheme ${XCSCHEME} \
-configuration Release \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \
DSTROOT=${WORKSPACE}/build/Products \
OBJROOT=${WORKSPACE}/build/Intermediates \
SYMROOT=${WORKSPACE}/build \
SHARED_PRECOMPS_DIR=${WORKSPACE}/build/Intermediates/PrecompiledHeaders \
build > ${WORKSPACE}/build/oclint/xcodebuild.log
${OCLINT_XCODEBUILD} ${WORKSPACE}/build/oclint/xcodebuild.log -o ${WORKSPACE}/compile_commands.json
${OCLINT_JSON_COMPILATION_DATABASE} -- \
-report-type=pmd \
-o ${WORKSPACE}/build/oclint/lint.xml \
-rc LONG_LINE=250 \
-rc LONG_VARIABLE_NAME=50 \
-max-priority-2=15 \
-max-priority-3=200
if [ "$?" -ne "0" ]; then
echo "[ ] ERROR! Integration failed!"
else
echo "[*] Integration successful!"
fi