forked from dbast/spark-scala-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci.sh
executable file
·95 lines (84 loc) · 3.12 KB
/
ci.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
#!/usr/bin/env bash
set -o errtrace -o nounset -o pipefail -o errexit
# Goto directory of this script
cd "$(dirname "${BASH_SOURCE[0]}")"
cleaning () {
echo "############################################"
echo "# #"
echo "# Cleaning #"
echo "# #"
echo "############################################"
./sbt clean
}
unit_tests () {
echo "############################################"
echo "# #"
echo "# Unit testing #"
echo "# #"
echo "############################################"
./sbt coverage test
}
integration_tests () {
echo "############################################"
echo "# #"
echo "# Integration testing #"
echo "# #"
echo "############################################"
./sbt coverage it:test
}
coverage_report () {
echo "############################################"
echo "# #"
echo "# Coverage report #"
echo "# #"
echo "############################################"
./sbt coverageReport
}
generate_api_doc() {
echo "############################################"
echo "# #"
echo "# Generating API documentaion #"
echo "# #"
echo "############################################"
./sbt doc
}
dependency_info() {
echo "############################################"
echo "# #"
echo "# Dependency information #"
echo "# #"
echo "############################################"
./sbt dependencyUpdates pluginUpdates dependencyTree
}
assemble() {
echo "############################################"
echo "# #"
echo "# Assembling binary artifact #"
echo "# #"
echo "############################################"
./sbt assembly
}
check_for_clean_worktree() {
echo "############################################"
echo "# #"
echo "# Check for clean worktree #"
echo "# #"
echo "############################################"
# To be executed after all other steps, to ensures that there is no
# uncommitted code and there are no untracked files, which means .gitignore is
# complete and all code is part of a reviewable commit.
GIT_STATUS="$(git status --porcelain)"
if [[ $GIT_STATUS ]]; then
echo "Your worktree is not clean, there is either uncommitted code or there are untracked files:"
echo "${GIT_STATUS}"
exit 1
fi
}
cleaning
unit_tests
integration_tests
coverage_report
generate_api_doc
dependency_info
assemble
check_for_clean_worktree